This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A031405 #24 Jul 13 2021 23:42:20 %S A031405 6,12,14,20,21,28,30,33,42,44,45,52,55,56,60,70,72,77,90,95,110,112, %T A031405 117,126,132,133,138,153,154,156,161,165,180,182,184,189,190,207,209, %U A031405 210,221,234,240,248,253,261,272,275,276,285,286,297,299,306,310,315 %N A031405 Numbers k such that the continued fraction for sqrt(k) has even period 2*m and the m-th term of the periodic part is 2. %H A031405 T. D. Noe, <a href="/A031405/b031405.txt">Table of n, a(n) for n = 1..1000</a> %e A031405 The c.f. for sqrt(6) is [2; 2, 4, ...] with period 2 and 1st term of the periodic part 2. %e A031405 The c.f. for sqrt(14) is [3; 1, 2, 1, 6, ...] with period 4 and 2nd term of the periodic part 2. %e A031405 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. %p A031405 filter:= proc(n) local P,l; %p A031405 if issqr(n) then return false fi; %p A031405 P:= numtheory:-cfrac(sqrt(n),'periodic','quotients')[2]; %p A031405 l:= nops(P); %p A031405 if l::odd then false %p A031405 else P[l/2] = 2 %p A031405 fi %p A031405 end proc: %p A031405 select(filter, [$1..1000]); # _Robert Israel_, Apr 14 2016 %t A031405 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 %Y A031405 Cf. A031404-A031423. %K A031405 nonn %O A031405 1,1 %A A031405 _David W. Wilson_