public class prime
{
public static void main(String[] args)
{
long thing = 600851475143L;
for(long i = 300425737571L ; i == 0 ; i-- ){
if (thing % i == 0)
{
long answer = i;
System.out.println(answer);
break;
}
}
}
}
This is the code I currently have, however I have been running it in DrJava for a few minutes and it has returned no results. I'm guessing there are roughly a million ways my code can be optimised though ; would anyone be able to give me some tips ?
Trying to work through a few programming problems today and this one is causing me some trouble.
Thanks a lot :)