%I #26 Apr 08 2024 15:39:55
%S 0,1,4,7,9,13,16,19,25,27,28,31,36,37,40,43,45,49,52,55,61,63,64,67,
%T 72,73,76,79,81,85,88,91,97,99,100,103,108,109,112,115,117,121,124,
%U 127,133,135,136,139,144,145,148,151,153,157,160,163,169,171,172
%N Values of N for which the equation x^2 - 9*y^2 = N has integer solutions.
%C This equation is a Pellian equation of the form x^2 - D^2*y^2 = N. A042965 covers the case D=1.
%C Also numbers that are congruent to {0,1,4,7,9,13,16,19,25,27,28,31} mod 36. - _Keyang Li_, Apr 05 2024
%H Colin Barker, <a href="/A230240/b230240.txt">Table of n, a(n) for n = 1..1000</a>
%H <a href="/index/Rec#order_13">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,0,0,0,0,0,0,0,0,1,-1).
%F G.f.: x^2*(5*x^11 +3*x^10 +x^9 +2*x^8 +6*x^7 +3*x^6 +3*x^5 +4*x^4 +2*x^3 +3*x^2 +3*x +1) / ((x -1)^2*(x +1)*(x^2 -x +1)*(x^2 +1)*(x^2 +x +1)*(x^4 -x^2 +1)).
%e For N=55, the equation x^2 - 9*y^2 = 55 has solutions (X,Y) = (8,1) and (28,9).
%o (PARI)
%o \\ Values of n for which the equation x^2 - d^2*y^2 = n has integer solutions.
%o \\ e.g. allpellsq(3, 20) gives [0,1,4,7,9,13,16,19]
%o allpellsq(d, nmax) = {
%o local(v=[0], n, w);
%o for(n=1, nmax,
%o w=pellsq(d, n);
%o if(#w>0, v=concat(v, n))
%o );
%o v
%o }
%o \\ All integer solutions to x^2-d^2*y^2=n.
%o \\ e.g. pellsq(5, 5200) gives [265,51;140,24;85,9]
%o pellsq(d, n) = {
%o local(m=Mat(), f, x, y);
%o fordiv(n, f,
%o if(f*f>n, break);
%o if((n-f^2)%(2*f*d)==0,
%o y=(n-f^2)\(2*f*d);
%o x=d*y+f;
%o m=concat(m, [x,y]~)
%o )
%o );
%o m~
%o }
%Y Cf. A042965, A230239.
%K nonn,easy
%O 1,3
%A _Colin Barker_, Oct 13 2013
|