Name: Anonymous 2016-02-21 1:30
I was asked this question by project euler -
I think I came with the greatest solution in the world.
I challenge anyone to do better than this.
It's 10 lines of code and finds the solution in less than 10 milliseconds.
Seriously, you can try as much as you want, but this solution is already the best in the world.
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
I think I came with the greatest solution in the world.
I challenge anyone to do better than this.
It's 10 lines of code and finds the solution in less than 10 milliseconds.
Seriously, you can try as much as you want, but this solution is already the best in the world.
#include <stdio.h>
int main(void)
{
int i = 2;
long n = 600851475143;
for (; n > 1; i++)
for (; n % i == 0; n /= i)
printf("%d\n", i);
return 0;
}