private static void addThreeFactors(long[] primes, List<Long> set) {
		for (int i = 1; i < primes.length && primes[i]*primes[i+1]*primes[i+2] <= limit; i++) {
			System.out.println(i + " three");
			long p1 = primes[i];
			for (int j = i+1; j < primes.length && primes[i]*primes[j]*primes[j+1] <= limit; j++) {
				if (j%1000==0)
					System.out.println(i + " " + j);
				long p2 = primes[j];
				for (int k = j+1; k < primes.length && p1*p2*primes[k] <= limit; k++) {
					long p3 = primes[k];
					long n = p1*p2*p3;
					
					if ((n-1) % (n-(p1-1)*(p2-1)*(p3-1)) == 0) {
						set.add(n);
					}					
				}
			}
		}
	}