We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Project Euler #134: Prime pair connection
Project Euler #134: Prime pair connection
Sort by
recency
|
10 Discussions
|
Please Login in order to post a comment
isnt this a faulty question? i mean if we see for l=19 and R=23 there exist 69 which is divisible by 23 and last digit is form by 19. then why we are taking 1219 as our answer?
It should end in 19, not just 9.
for L,R in higher range i.e. 10^6 - 10^9 the final answer overflows long int range in cpp hence can only be represented as strings.
You must store two numbers l1 and l2. l1 = answer/base and l2 = answer%base. Can avoid strings. Got AC with 100 points.
I still got TLE :,v
me too , i have find some "tutorials" in web;s author: Kristan but only earn 50 d , when n>100000000 , i use miller rebin but it still over time .
When testing for many primes in bulk, Miller Rabin is actually quite slow. A Sieve of Eratosthenes may be faster.
But before changing your code, find out which part is slow: the prime testing, or finding the S values.
Can someone tell me what is wrong with this code...? thanks in advance
Can some one tell me what kind of test case 10 onwards is?. Till 9th test I am getting correct answer but from 10 to 18 all are showing wrong answer.
Thanks
Maybe an overflow issue? How big do the numbers get?
I tried various large numbers (R<=10^9), but the answers are coming well within the range of long long int. But still wrong answer in the last cases.Any clue? Thanks.