login
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 59.
1

%I #18 Jul 06 2024 16:06:15

%S 3483,3491,3499,3511,3527,3539,3547,3559,3571,3579,3583,3587,3607,

%T 3623,3631,3643,3647,3651,3659,3667,3671,3691,3699,3707,3719,13928,

%U 13952,13960,13984,14016,14080,14120,14152,14176,14208,14216,14240,14248,14304

%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 59.

%H Chai Wah Wu, <a href="/A031557/b031557.txt">Table of n, a(n) for n = 1..10000</a>

%t cfep59Q[n_]:=Module[{s=Sqrt[n],cf,len},cf=If[IntegerQ[s],{1}, ContinuedFraction[ s][[2]]];len=Length[cf];EvenQ[len]&&cf[[len/2]] == 59]; Select[Range[15000],cfep59Q] (* _Harvey P. Dale_, Feb 18 2016 *)

%o (Python)

%o from __future__ import division

%o from sympy import continued_fraction_periodic

%o A031557_list = [n for n, s in ((i, continued_fraction_periodic(0,1,i)[-1]) for i in range(1,10**5)) if isinstance(s, list) and len(s) % 2 == 0 and s[len(s)//2-1] == 59] # _Chai Wah Wu_, Jun 08 2017

%K nonn

%O 1,1

%A _David W. Wilson_