%I #25 Aug 07 2015 02:41:54
%S 5,13,17,29,37,41,53,61,65,73,85,89,97,101,109,113,125,137,145,149,
%T 157,173,181,185,193,197,229,233,241,257,265,269,277,281,293,313,317,
%U 325,337,349,353,365,373,389,397,401,409,421,425,433,445,449,457,461,481,485
%N Nonsquare integers n such that the continued fraction (sqrt(n)+1)/2 has odd period length.
%C Nonsquare integers n for which Pell equation x^2 - n*y^2 = -4 has infinitely many integer solutions. The smallest solutions are given in A078356 and A078357.
%D O. Perron, "Die Lehre von den Kettenbruechen, Bd.I", Teubner, 1954, 1957 (Sec. 30, table p. 108).
%H Vincenzo Librandi, <a href="/A077426/b077426.txt">Table of n, a(n) for n = 1..1000</a>
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Pell%27s_equation">Pell's equation</a>
%p isOddPrim := proc(n::integer)
%p local cf;
%p cf := numtheory[cfrac]((sqrt(n)+1)/2,'periodic','quotients') ;
%p if nops(op(2,cf)) mod 2 =1 then
%p RETURN(true) ;
%p else
%p RETURN(false) ;
%p fi ;
%p end:
%p notA077426 := proc(n::integer)
%p if issqr(n) then
%p RETURN(true) ;
%p elif not isOddPrim(n) then
%p RETURN(true) ;
%p else
%p RETURN(false) ;
%p fi ;
%p end:
%p A077426 := proc(n::integer)
%p local resul,i ;
%p resul := 5 ;
%p i := 1 ;
%p while i < n do
%p resul := resul+4 ;
%p while notA077426(resul) do
%p resul := resul+4 ;
%p od ;
%p i:= i+1 ;
%p od ;
%p RETURN(resul) ;
%p end:
%p for n from 1 to 61 do print(A077426(n)) ; od : # _R. J. Mathar_, Apr 25 2006
%t fQ[n_] := !IntegerQ@ Sqrt@ n && OddQ@ Length@ ContinuedFraction[(Sqrt@ n + 1)/2][[2]]; Select[Range@ 500, fQ] (* _Robert G. Wilson v_, Nov 17 2012 *)
%Y A subsequence of A077425.
%Y Odd elements of A003814.
%Y Cf. A077427, A172000.
%K nonn,easy
%O 1,1
%A _Wolfdieter Lang_, Nov 29 2002
%E Edited and extended by _Max Alekseyev_, Mar 03 2010
%E Edited by _Max Alekseyev_, Mar 05 2010