Project Euler #168: Number Rotations

Sort by

recency

|

43 Discussions

|

  • + 0 comments

    can anyone exlain the problem?

  • + 0 comments

    getting error for this logic after m=15

    def sumof (m):
        sume=0
        for b in range(1,10):
            for n in range(2,m+1):
                for x in range(1,10):
                    a=b*((10**(n-1))-x)/(10*x-1)
                    if len(str(a).split('.')[0])==(n-1) and float(str(a).split('.')[1])==0:
                        sume+=a*10 + b
        return int(sume%100000)
    
  • + 1 comment

    n=int(input()) sum=0 for i in range(11,10**n): nfinal=str(i)[-1]+str(i)[0:len(str(i))-1] if(int(nfinal)%i==0): sum+=i print(sum%(10**5))

    i am getting timeout error being my code so short. please help anuone

  • + 1 comment
    n = int(input())
    
    sum = 0
    
    for i in range(2, n+1):
    
        for j in range(1, 9+1):
    		
            for k in range(1, 9+1):
    				
                temp = (j*(10**(i-1) - k))%(10*k - 1)
    						
                if temp == 0:
    						
                    ans = f"{int((j*(10**(i-1) - k))/(10*k - 1))}"+ f"{j}"
    								
                    if len(ans) > 5:
    								
                        sum += int(ans[-5:len(ans)+1])
                        print(ans)
    										
                    else:
                        sum += int(ans)
                        print(ans)
    
    Please tell me what I am doing wrong, this code is only passing 2 test cases.       
    
  • + 0 comments

    If 495 is the result of the scenario when n=2 and the constituent numbers are 11,22,33,44,55,66,77,88,99 then... How are 22,33,44,55,66,77,88,99 special numbers? Obviously 11 is... (1 * 10) + 1 = 1 * (1 * 10) + 1 But take 22 for instance: 22 is (2 * 10) + 2 != 2 * (2 * 10) + 2 By my understanding 22 is not a special number, neither are 33,44,...,99.