OFFSET
1,1
LINKS
T. D. Noe, Table of n, a(n) for n = 1..1000
EXAMPLE
The c.f. for sqrt(6) is [2; 2, 4, ...] with period 2 and 1st term of the periodic part 2.
The c.f. for sqrt(14) is [3; 1, 2, 1, 6, ...] with period 4 and 2nd term of the periodic part 2.
The c.f. for sqrt(21) is [4; 1, 1, 2, 1, 1, 8, ...] with period 6 and 3rd term of the periodic part 2.
MAPLE
filter:= proc(n) local P, l;
if issqr(n) then return false fi;
P:= numtheory:-cfrac(sqrt(n), 'periodic', 'quotients')[2];
l:= nops(P);
if l::odd then false
else P[l/2] = 2
fi
end proc:
select(filter, [$1..1000]); # Robert Israel, Apr 14 2016
MATHEMATICA
n = 1; t = {}; While[Length[t] < 50, n++; If[! IntegerQ[Sqrt[n]], c = ContinuedFraction[Sqrt[n]]; len = Length[c[[2]]]; If[EvenQ[len] && c[[2, len/2]] == 2, AppendTo[t, n]]]]; t
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved