Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
A bit of a slice solution in Clear category for Exploring Calkin-Wilf Tree by veky
def calkin_wilf(n: int) -> (int, int):
x = y = 1
for bit in bin(n)[3:]:
if int(bit): x += y
else: y += x
return x, y
May 3, 2024