public int[] BPrimeFactorization(int n) { int[] powers = new int[n + 1]; List <long> pieceFactorization; for (int i = n; i >= 2; i--) { int power = 2 * i - n - 1; pieceFactorization = PrimeTools.PrimeFactorization(i); foreach (long factor in pieceFactorization) { powers[factor] += power; } } return(powers); }
public bool cubeFull(long n) { if (n < 1) { return(false); } else if (n == 1) { return(true); } List <long> pF = PrimeTools.PrimeFactorization(n); int i = 0; int j; //Console.WriteLine($"Counting duplicates, {n} has {pF.Count} prime factors."); while (i < pF.Count) { j = i + 1; while (j < pF.Count && pF[i] == pF[j]) { j++; } if (j - i < 3) { return(false); } else if (j == pF.Count) { return(true); } else { i = j; } } throw new NotImplementedException($"Determine whether {n} is cube-full."); }