/* Naive factorization */

import MyInteger;

class Factorize {
	
	public static void getFactor(MyInteger ival) {
	
		MyInteger i = new MyInteger(3);
		MyInteger two = new MyInteger(2);
		MyInteger iSquared = new MyInteger(9);
		boolean gotFactor = false;

		while (!gotFactor && !ival.lessThan(iSquared)) {
				if (i.divides(ival)) {
					gotFactor = true;
					i.showValue();
				} else {
					i.plus(two);
					iSquared = i.squareOf();
				}
		}
		if (!gotFactor)
			System.out.println("Prime");
	}

	public static void main(String args[]) {
		MyInteger m1 = new MyInteger(899);
		MyInteger m2 = new MyInteger(401);
		MyInteger m3 = new MyInteger(769);
		MyInteger m4 = new MyInteger(68983);
		
		Factorize.getFactor(m1);
		Factorize.getFactor(m2);
		Factorize.getFactor(m3);
		Factorize.getFactor(m4);
	}
}
