A031417 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 4.
274, 370, 481, 797, 953, 1069, 1249, 1313, 1378, 1381, 1514, 1657, 1658, 1733, 1889, 2125, 2297, 2377, 2554, 2557, 2833, 2834, 2929, 2941, 3226, 3329, 3338, 3433, 3541, 3761, 3874, 3989, 4093, 4106, 4441, 4442, 4561, 4682, 4685, 4933, 4937, 5197, 5450
Offset: 1
Keywords
Examples
The simple continued fraction for sqrt(274) = [16; 1, 1, 4, 4, 1, 1, 32, ...] with odd period 7 and central term 4. Another example is sqrt(481) = [21; 1, 13, 1, 1, 1, 4, 4, 1, 1, 1, 13, 1, 42, ...] with odd period 13 and central term 4. - _Michael Somos_, Apr 03 2014
Links
- T. D. Noe, Table of n, a(n) for n = 1..999
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]] == 4, AppendTo[t, n]]]]; t (* T. D. Noe, Apr 03 2014 *) cf4Q[n_]:=Module[{s=Sqrt[n],cf,len},cf=If[IntegerQ[s],{1,1},ContinuedFraction[ s][[2]]];len=Length[cf];OddQ[len]&&cf[[(len+1)/2]] == cf[[(len-1)/2]]==4]; Select[Range[5500],cf4Q] (* Harvey P. Dale, Jul 28 2021 *)
Extensions
a(1) corrected by T. D. Noe, Apr 03 2014