Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. #define NUMBER 600851475143
  6.  
  7. int isitprime(unsigned long int);
  8.  
  9. int main()
  10. {
  11.     unsigned long int x = 1;
  12.     unsigned int largestprime = 42;
  13.     int y;
  14.  
  15.     for (x = 1; x <= sqrt(NUMBER); x++)
  16.         {
  17.             printf("Testing %li \n", x);
  18.  
  19.             if ((NUMBER % x) == 0)
  20.                 if ((y = isitprime (x)))
  21.                     largestprime = x;
  22.         }
  23.  
  24.     printf("Largest prime is: %i", largestprime);
  25.     return 0;
  26. }