cp's OEIS Frontend

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.

A077426 Nonsquare integers n such that the continued fraction (sqrt(n)+1)/2 has odd period length.

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