%I #18 Jul 10 2021 19:34:30
%S 58,73,202,250,274,314,349,425,538,761,1010,1073,1130,1301,1546,1745,
%T 1825,1898,2050,2173,2258,2330,2482,2581,2777,3161,3202,3554,3877,
%U 3890,4106,4133,4346,4586,4925,5162,5261,5273,5297,5305
%N Numbers k such that the continued fraction for sqrt(k) has period 7.
%H Chai Wah Wu, <a href="/A010338/b010338.txt">Table of n, a(n) for n = 1..10000</a> (terms n = 1..500 from Harvey P. Dale)
%t cfp7Q[n_]:=Module[{s=Sqrt[n]},!IntegerQ[s]&&Length[ ContinuedFraction[ s][[2]]]==7]; Select[Range[6000],cfp7Q] (* _Harvey P. Dale_, Aug 11 2013 *)
%o (Python)
%o from sympy import continued_fraction_periodic
%o A010338_list = [n for n, s in ((i, continued_fraction_periodic(0,1,i)[-1]) for i in range(1,10**3)) if isinstance(s, list) and len(s) == 7] # _Chai Wah Wu_, Jun 08 2017
%K nonn
%O 1,1
%A _N. J. A. Sloane_, Walter Gilbert
|