Project Euler Question 3 Help

后端 未结 16 1363
攒了一身酷
攒了一身酷 2020-12-08 08:25

I\'m trying to work through Project Euler and I\'m hitting a barrier on problem 03. I have an algorithm that works for smaller numbers, but problem 3 uses a very, very large

16条回答
  •  Happy的楠姐
    2020-12-08 09:10

    You need to reduce the amount of checking you are doing ... think about what numbers you need to test.

    For a better approach read up on the Sieve of Erathosthenes ... it should get you pointed in the right direction.

提交回复
热议问题