login
Value x in the solution of x^2-D*y^2=-1 as D runs through A003654.
2

%I #6 Oct 19 2014 13:30:52

%S 7,38,117,18,268,515,70,882,32,182,99,29718,2072,1068,43,2943,378,500,

%T 5604,4030,4005,8890182,776,5357,57,1744,6948,113582,4832118,8827,

%U 1118,1111225770,68,1764132,11018,3141,251,13545,1710,23156,71011068,16432,6072,82,1407,8920484118,1063532,19703

%N Value x in the solution of x^2-D*y^2=-1 as D runs through A003654.

%C The pair (x,y) is taken from the numerator of the earliest (lowest order) convergent to the continued fraction of sqrt(D) that satisfies the "non-Pell" equation.

%p A249021 := proc(n)

%p local dis,cf,o,q,x,y ;

%p dis := A003654(n) ;

%p cf := numtheory[cfrac](sqrt(dis),'periodic','quotients') ;

%p for o from 1 do

%p q := numtheory[nthconver](cf,o) ;

%p x := numer(q) ;

%p y := denom(q) ;

%p if x^2-dis*y^2 = -1 then

%p return x ;

%p end if;

%p end do:

%p end proc:

%p seq(A249021(n),n=1..50) ;

%Y Cf. A130226.

%K nonn

%O 1,1

%A _R. J. Mathar_, Oct 19 2014