Help with Project Euler # 200?

Possible duplicate:
Need help solving Project Euler 200

Similarly this question

Project Euler Problem 200.

I wrote a brute force solution in Java that takes several hours to run, and produced the first 500+ sqube numbers, which I thought should be sufficient. However, none of the answers from 190 to 210 seems to be the correct answer.

I am wondering what I'm doing wrong here and how I can optimize it. Could the problem be BigInteger.isProbablePrime()?

I'm not sure Stackoverflow is the best place to ask about this, but I seem to be stuck. I included my code and the generated data.

I would really appreciate if anyone would give me hints or pointers.

Edit: I ran the program again using the first 500,000 primes; took a day to fulfill, but gave the correct answer.

+1
source share
4 answers

I am the administrator of Project Euler. Please do not post information that could ruin the problem for others, especially code and answers, even half-functioning code. Change your question accordingly. EDIT: Thanks for that!

It is not uncommon for solvers to use the Internet to search for information on solving a problem, and this would make them have fun if they stumbled upon such a spoiler. (Yes, I know that there are sites with many ready-made solutions, but at least they are usually for simple problems with numbered numbers.)

, .

+16

, , ?: D , isProbablePrime, , . , . , , .

0

, isProbablyPrime (, ). , , BigInteger. . ?

0

, , . , . n . , . , , . 200. , , , . TreeSet , , , 200- .

0

All Articles