A031415 Numbers k such that the continued fraction for sqrt(k) has odd period and if the last term of the periodic part is deleted then there are a pair of central terms both equal to 2.
41, 61, 113, 130, 181, 202, 265, 269, 313, 317, 394, 421, 458, 586, 613, 617, 685, 697, 761, 773, 853, 925, 929, 937, 986, 1013, 1066, 1109, 1117, 1201, 1213, 1301, 1325, 1354, 1409, 1417, 1429, 1466, 1586, 1625, 1637, 1649, 1714, 1741, 1745, 1753, 1861
Offset: 1
Keywords
Examples
The simple continued fraction expansion of sqrt(41) = [6; 2, 2, 12, 2, 2, 12, 2, 2, 12, ...] with odd period 3 and two terms equal to 2. Another example is sqrt(202) = [14; 4, 1, 2, 2, 1, 4, 28, 4, 1, 2, 2, 1, 4, 28, 4, 1, 2, 2, 1, 4, 28, ...] with odd period 7 and two terms equal to 2. - _Michael Somos_, Apr 03 2014
Links
- Chai Wah Wu, Table of n, a(n) for n = 1..10000 (terms n = 1..999 from T. D. Noe)
Programs
-
Mathematica
n = 1; t = {}; While[Length[t] < 50, n++; If[! IntegerQ[Sqrt[n]], c = ContinuedFraction[Sqrt[n]]; len = Length[c[[2]]]; If[OddQ[len] && c[[2, (len + 1)/2]] == 2, AppendTo[t, n]]]]; t (* T. D. Noe, Apr 03 2014 *)
-
Python
from sympy.ntheory.continued_fraction import continued_fraction_periodic A031415_list = [] for n in range(1,10**3): cf = continued_fraction_periodic(0,1,n) if len(cf) > 1 and len(cf[1]) > 1 and len(cf[1]) % 2 and cf[1][len(cf[1])//2] == 2: A031415_list.append(n) # Chai Wah Wu, Sep 16 2021
Extensions
a(1) corrected by T. D. Noe, Apr 03 2014
Comments