package com.codewars.primedecomp;

/**
 * MIT License
 * (c) 2017 Ricardo Constantino
 */

public class PrimeDeComp {
    // int lst = 7775460;

    public static void main(String[] args) {
        System.out.println(factors(7775460));
    }

    public static String factors(int lst) {
        String result = "";
        for (int fac = 2; fac <= lst; ++fac) {
            int count;
            for (count = 0; lst % fac == 0; ++count) {
                lst /= fac;
            }
            if (count > 0) {
                result += "(" + fac + (count > 1 ? "**" + count : "") + ")";
            }
        }
        return result;
    }

}
