user2994cb
searching PlanetScale…
- 1.▲
- 2.▲
- 3.▲
- 4.▲
- 5.▲
- 6.▲
11 ms·
- 61.▲
Code to print both the Stern-Brocot tree and the Calkin-Wilf tree, using the algorithm in that paper: def fractions():
a,b,c,d = 1,0,0,1
while True:
yield a,b,c,d
if a == 1 and b == 0 and d == 1:
a, - 62.▲
- 63.▲
- 64.▲
- 65.▲
- 66.▲
- 67.▲
- 68.▲
- 69.▲
- 70.▲
- 71.▲
- 72.▲
- 73.▲
- 74.▲
- 75.▲
- 76.▲
- 77.▲
- 78.▲
- 79.▲
- 80.▲
- 81.▲
- 82.▲
- 83.▲
- 84.▲
- 85.▲
- 86.▲
- 87.▲
- 88.▲
- 89.▲
- 90.▲
More ›