Hacker News new | ask | show | jobs
by mattmoose21 27 days ago
bad python incoming:

    digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"

    def base_conv(num, base):
        if num == 0:
            return "0"
        if base > 36:
            return "too big of base"
        result = ""
        while num > 0:
            result = digits[num%base] + result
            num //= base
        return result

    i = 5;
    b = 18;
    while b < 37:
        print(base_conv(4\*i,b))
        i += 1
        b += 3
results: 12 13 14 15 16 17 18

Beyond this you need to get more creative with your digit symbols.

*edit: bad formatting