Hi, I'm working on a problem for project Euler and its asking me to get the greatest prime factor of 600851475143. I made the code that would give me it but after a certain number :716151937. It stops computing. If someone could point me in the right direction that would be great.
I don't think it stops. I think your algorithm is just going to take a very long time to finish.
Also, it might make more sense if you were to only output numbers for which isPrime returned true. Your rather horrible indentation and formatting probably lead to you think that's what you're doing now, but you are not.
You may also want to consider this:
If I wanted to find the greatest prime factor for 78 and I did it on paper, I might come up with something that looks like:
2 * 39
3 * 13
which may be suggestive to you. Once you've found a factor, the number you're trying to factor can be reduced. The largest prime factor of 78 is the largest prime factor of 39 which is also the largest prime factor of 13, which happens to be prime.