C++ program to find largest prime factor of a number

Pages: 12
But it is not working
:(
Some theory:
A number is prime if it cant be divided by any prime number less than or equal to its square root.
2 is a prime number.

So the largest prime factor of a number is the number itself (if it is prime) or a value less than or equal to its square root.
Therefore you only need all the primes below sqrt(600851475143) = 775147
If you use dynamic programming, can speed up.

Then factorice.
Topic archived. No new replies allowed.
Pages: 12