I have a feeling that your way of checking primes might be inefficient. Perhaps not, but you never know. I've attached my code.
Originally Posted by Hazique35
Use unsigned long longs for the big numbers. Your number returns 0, i.e. false. It's not a prime.
using namespace std;
bool isPrime(unsigned long long n)
unsigned long long root = floor(sqrt(n)) + 1;
for (unsigned long long i = 2; i <= root; i++)
if (n % i == 0)
bool Prime = isPrime(600851475143ULL);
cout << Prime << endl;