Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Formula from literature, calculating binary weight by shifting solution in Creative category for Ulam–Warburton Automaton by TheRing
def binary_weight(x: int) -> int:
result = 0
while x:
result += x & 1
x = x >> 1
return result
def automaton(step: int) -> int:
return 1 + 4 * sum(3 ** (binary_weight(k) - 1) for k in range(1, step))
April 26, 2023