A206578 The least number with exactly n ones in the continued fraction of its square root.
2, 3, 14, 7, 13, 91, 43, 115, 94, 819, 133, 1075, 211, 1219, 309, 871, 421, 1147, 244, 3427, 478, 2575, 991, 8791, 604, 3799, 886, 5539, 1381, 8851, 1279, 7303, 1561, 19519, 1759, 10339, 1831, 12871, 2038, 13771, 1999, 8611, 1516, 15871, 2731, 20875, 1726
Offset: 0
Keywords
Links
- Chai Wah Wu, Table of n, a(n) for n = 0..10000 (terms 0..1000 from T. D. Noe)
Crossrefs
Programs
-
Mathematica
nn = 50; zeros = nn; t = Table[0, {nn}]; k = 2; While[zeros > 0, If[! IntegerQ[Sqrt[k]], cnt = Count[ContinuedFraction[Sqrt[k]][[2]], 1]; If[cnt <= nn && t[[cnt]] == 0, t[[cnt]] = k; zeros--]]; k++]; Join[{2}, t]
-
Python
from sympy import continued_fraction_periodic def A206578(n): m = 1 while True: s = continued_fraction_periodic(0,1,m)[-1] if isinstance(s,list) and s.count(1) == n: return m m += 1 # Chai Wah Wu, Jun 12 2017
Comments