600851475143 is probably above the precision of your platform's long data type. It requires at least 40 bits to store. You can use this to figure out how many bits you have:
#include
printf("my compiler uses %u bits for the long data type\n", (unsigned int) (CHAR_BIT * sizeof (long)));