You are viewing a single comment's thread. Return to all comments →
C++ Solution, may not be the best, but works.
int primeCount(long n) { int result = 0; double long x = 1; for(int i = 2; i < 50; ++i) { bool isPrime = true; for(int j = 2; j <= sqrt(i); ++j) { if(i % j == 0 && i != 2) { isPrime = false; break; } } if(isPrime) { x *= i; if(x > n) break; else if (x == n) { result++; break; } result++; } } return result; }
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, may not be the best, but works.