0

How can I modify this code to get efficient output for 10^10 . Within 2second

def palindrome(a): org=a a=str(a) return int(a[::-1])==org if 1 else 0 def factor(a): b=[palindrome(i) for i in range(1,a+1) if a%i==0] return b t=int(input()) j=1 while(t): a=int(input()) l=factor(a) print("case #",j,": ",sum(l),sep="") j+=1 t-=1 I tried more way but can't

25th Apr 2022, 12:33 PM
Sudalai Vignesh
3 Answers
+ 2
Sudalai Vignesh , ? Do I understand correctly that you want to calculate 10 to the power of 10. are there any restrictions to consider ? it would be nice if you could give us some explanation what the code is doing.
25th Apr 2022, 3:39 PM
Lothar
Lothar - avatar
+ 1
Print(10 ** 10) ?
25th Apr 2022, 5:55 PM
Thomas Z
Thomas Z - avatar
0
It finds factors of the give no. And count how many palindrome are there for the given test cases
26th Apr 2022, 1:57 AM
Sudalai Vignesh