Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
5-liner: bit by bit solution in Clear category for Exploring Calkin-Wilf Tree by przemyslaw.daniel
def calkin_wilf(n: int) -> tuple[int, int]:
result = [0, 1]
for bit in f"{n:b}":
result[bit == '0'] += result[bit == '1']
return tuple(result)
Dec. 29, 2023
Comments: