A031509 Numbers k such that the continued fraction for sqrt(k) has even period and if the last term of the periodic part is deleted the central term is 11.
123, 127, 131, 139, 151, 163, 167, 488, 512, 520, 544, 608, 640, 672, 1095, 1167, 1383, 1455, 1515, 1944, 2008, 2136, 2264, 2456, 2648, 2696, 3035, 3115, 3215, 3235, 3415, 3515, 3635, 3715, 3735, 3835, 3935, 4115, 4135, 4215, 4368, 4944, 5496, 5943, 5971
Offset: 1
Keywords
Examples
The c.f. expansion of sqrt(127) is 11, [3, 1, 2, 2, 7, 11, 7, 2, 2, 1, 3, 22], [3, 1, 2, 2, 7, 11, 7, 2, 2, 1, 3, 22], ... If the 22 is deleted from the periodic part the central term is 11. - _N. J. A. Sloane_, Aug 17 2021
Links
- Robert Israel, Table of n, a(n) for n = 1..1000
Programs
-
Maple
# Maple 2016 or later. filter:= proc(n) uses NumberTheory; local R; if issqr(n) then return false fi; R:= Term(ContinuedFraction(sqrt(n)),periodic)[2]; nops(R)::even and R[nops(R)/2] = 11 end proc: select(filter, [$2..10000]); # Robert Israel, Jun 07 2019
-
Mathematica
okQ[k_] := Module[{c, lc}, If[IntegerQ[Sqrt[k]], False, c = ContinuedFraction[Sqrt[k]]; lc = Length[c[[2]]]; EvenQ[lc] && c[[2, lc/2]] == 11]]; Select[Range[10000], okQ] (* Jean-François Alcover, Jul 09 2021 *)