A360564 Numerators of breadth-first numerator-denominator-incrementing enumeration of rationals in (0,1).
1, 1, 1, 2, 1, 1, 2, 1, 3, 1, 2, 4, 1, 3, 1, 2, 3, 4, 1, 5, 1, 2, 5, 6, 1, 3, 5, 3, 1, 2, 4, 1, 3, 5, 1, 2, 3, 4, 5, 6, 1, 5, 7, 1, 2, 5, 6, 7, 8, 1, 3, 7, 9, 1, 2, 4, 8, 10, 1, 3, 5, 9, 5, 1, 2, 3, 4, 5, 6, 9, 10, 1, 5, 7, 11, 1, 2, 6, 7, 8, 11, 12, 1, 3, 3, 7, 4, 9, 11
Offset: 1
Examples
To build the tree, 1/2 only has child 1/3, since 2/2 = 1 is outside of (0,1). Then 1/3 has children 1/4 and 2/3. In turn, 1/4 only has child 1/5 because 2/4 = 1/2 has already occurred, and 2/3 has no children because 2/4 has already occurred and 3/3 is too large. Thus, the sequence begins 1, 1, 1, 2, 1, ... (the numerators of 1/2, 1/3, 1/4, 2/3, 1/5, ...).
Links
- Glen Whitney, Table of n, a(n) for n = 1..10052
- G. Gordon and G. Whitney, The Playground Problem 367, Math Horizons, Vol. 26 No. 1 (2018), 32-33.
Crossrefs
Programs
-
Python
from fractions import Fraction row = [Fraction(1,2)] seen = set([Fraction(1,2), Fraction(1,1)]) limit = 25 # chosen to generate 10000 fractions nums = [] denoms = [] rowsizes = [] while row[0].denominator <= limit: rowsizes.append(len(row)) newrow = [] for frac in row: nums.append(frac.numerator) denoms.append(frac.denominator) for nf in [Fraction(frac.numerator, frac.denominator+1), Fraction(frac.numerator+1, frac.denominator)]: if not(nf in seen): newrow.append(nf) seen.add(nf) row = newrow print(', '.join(str(num) for num in nums)) print(', '.join(str(denom) for denom in denoms)) print(', '.join(str(rowsize) for rowsize in rowsizes))
Comments