You are viewing a single comment's thread. Return to all comments →
C# solution:
public static int primeCount(long n) { ulong productOfPrimes=1; ulong[] firstPrimes= {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53}; for (int i = 0 ; i <firstPrimes.Length; i++){ productOfPrimes*=firstPrimes[i]; if(productOfPrimes > (ulong)n) return i; if(productOfPrimes == (ulong)n) return i+1; } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Leonardo's Prime Factors
You are viewing a single comment's thread. Return to all comments →
C# solution: