%I #21 Jul 06 2024 15:58:29
%S 786,802,822,834,838,862,866,878,886,898,1767,1797,1803,1812,1821,
%T 1833,1839,1857,1884,1893,1911,1929,1941,1956,1977,1983,2013,2022,
%U 3140,3148,3180,3188,3196,3212,3228,3236,3244,3260,3276,3284,3292,3308,3316,3340
%N 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 28.
%t okQ[n_] := Module[{cf, p}, cf = ContinuedFraction[Sqrt[n]]; p = FindTransientRepeat[cf, 2][[1, 2]]; EvenQ[lp = Length[p]] && p[[lp/2]] == 28];
%t Reap[Do[If[okQ[n], Sow[n]], {n, 1, 3340}]][[2, 1]] // Quiet (* _Jean-François Alcover_, Dec 14 2017 *)
%t cf28Q[n_]:=Module[{s=Sqrt[n],cf,len},cf=If[IntegerQ[s],{1},ContinuedFraction[ s][[2]]];len=Length[cf];EvenQ[len]&&cf[[len/2]] == 28]; Select[ Range[3400],cf28Q] (* _Harvey P. Dale_, Jun 03 2021 *)
%K nonn
%O 1,1
%A _David W. Wilson_
|