Instantly share code, notes, and snippets.

Embed
What would you like to do?
Base_Exchange_Palindrome
num = 10
judge = False
try:
while True:
base = input().split(',')
except EOFError:
pass
base_01 = int(base[0])
base_02 = int(base[1])
def radix_convert(number, radix):
s = []
while number>0:
s.append(number%radix)
number = number//radix
return s[::-1]
while judge == False:
num_base01 = radix_convert(num, base_01)
num_base02 = radix_convert(num, base_02)
if num_base01 != num_base01[::-1] or num_base02 != num_base02[::-1]:
judge = False
num += 1
else:
judge = True
print(num)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment