Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
one-liner solution in Clear category for The Good Radix by tom-tom
def checkio(number):
return min((i for i in range(max(int(c, 36) for c in number) + 1, 37) if int(number, i) % (i - 1) == 0), default=0)
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert checkio("18") == 10, "Simple decimal"
assert checkio("1010101011") == 2, "Any number is divisible by 1"
assert checkio("222") == 3, "3rd test"
assert checkio("A23B") == 14, "It's not a hex"
assert checkio("IDDQD") == 0, "k is not exist"
print('Local tests done')
Oct. 4, 2016