public static int factors ( int a ) {
	set = new TreeSet<Integer>();
	int i=2;
	while ( a>=1 && i<=a && set.size()<5 ) {
	    if ( isPrime(i) && a%i==0 ) {
		a /= i;
		set.add(i);
	    }
	    if ( a%i!=0 ) {
		i++;
	    }
	}
	return set.size();
    }