Mystery längs 26:an #218

Mystery längs 26:an #218

def number2base(x, base):
    digs = "0123456789abcdefghijklmnopqrstuvwxyz"
    if x == 0:
        return digs[0]
    digits = []
    while x:
        digits.append(digs[x % base])
        x = x // base
    digits.reverse()
    return ''.join(digits)


j = 1
for i in range(0, 2345665433):
    base22 = number2base(i, 22)
    if base22 == base22[::-1]:
        base33 = number2base(i, 33)
        if base33 == base33[::-1]:
            print(str(j) + " " + str(i) + " " + base22 + " " + base33)
            if j == 48:
                break
            j += 1