• + 1 comment
    def strangeCounter(t):
        tme, val = 1, 3
        while t > tme + val - 1:
            tme += val
            val *= 2
        return val - (t - tme)