[Performance] Find Prime with condition and range (1 to 10^15) 3 testcase | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

[Performance] Find Prime with condition and range (1 to 10^15) 3 testcase

I have a question about performance. There are alot prime from 1-10^15. So we make some rules to find smaller result : Number should be prime it self All digits in the prime number should be prime too, that mean only [2,3,5,7]. We should find all number that satisfying the condition under 4 second. I can do (1-10000000) 1 testcase in 1.6s for java languange using AKS primality test. What if the input are (1 to 10^15) 3 testcase: 3 1 1000000000 1 100000000000 1 1000000000000000 that mean we should find prime from 1 to 1000000000, then 1 to 100000000000, and then 1 to 1000000000000000, i think we can do memoization for 1-1000000, but not bigger than that. Can we achieve it under 4 second for 3 testcase?

21st Mar 2018, 1:52 PM
Momo Belia
Momo Belia - avatar
1 Answer
0
bump this post
21st Mar 2018, 3:25 PM
Momo Belia
Momo Belia - avatar