You are viewing a single comment's thread. Return to all comments →
100 points.
def convert(n,b): if n==0: return 0 res='' while n>0: n,r=divmod(n,b) res=str(r)+res return res n,k=map(int,input().strip().split()) s=0 for i in range(1,n): c=convert(i,k) if str(i)==str(i)[::-1] and c==c[::-1]: s+=i print(s)
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Project Euler #36: Double-base palindromes
You are viewing a single comment's thread. Return to all comments →
100 points.