A student approached me and asked why his prime checker wouldnt work. I took a look and it should work, imo, for all < 64 bit inputs.
int isitprime(unsigned long long in)
unsigned long long c;
unsigned long long max = sqrt(in);
if(in <= 1 )
if(in == 2)
for(c=2; c<max; i++)
if(in%c == 0)
checked for a bunch of primes i could think of 0,1,2,3,4,5,6,7 up to 18446744073709551557, which is supposed to be one of the largest 64 bit primes. Worked.