Project Euler #134: Prime pair connection

Sort by

recency

|

10 Discussions

|

  • + 1 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?

  • + 1 comment

    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.

  • + 1 comment

    I still got TLE :,v

  • + 0 comments

    Can someone tell me what is wrong with this code...? thanks in advance

    n=int(input())
    import math
    for r in range(n):
        a,b=(int(i) for i in input().split())
        l=[]
        for i in range(a,b):
            for j in range(2,int(math.sqrt(b)+1)):
                if i%j==0:
                    break
            else:
                l.append(i)
        for i in range(b,2*b):
            for j in range(2,int(math.sqrt(2*b)+1)):
                if i%j==0:
                    break
            else:
                l.append(i)
                break
        w=0
        for i in range(len(l)-1):
            s,d=str(l[i]),str(l[i+1])
            q=1
            u=0
            while(True):
                k=str(q)+s
                if int(k)%int(d)==0:
                    u=int(k)
                    break
                q+=1
            w+=u
        print(w)
    
  • + 1 comment

    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