login
A230239
Values of N for which the equation x^2 - 4*y^2 = N has integer solutions.
5
0, 1, 4, 5, 9, 12, 13, 16, 17, 20, 21, 25, 28, 29, 32, 33, 36, 37, 41, 44, 45, 48, 49, 52, 53, 57, 60, 61, 64, 65, 68, 69, 73, 76, 77, 80, 81, 84, 85, 89, 92, 93, 96, 97, 100, 101, 105, 108, 109, 112, 113, 116, 117, 121, 124, 125, 128, 129, 132, 133, 137
OFFSET
1,3
COMMENTS
This equation is a Pellian equation of the form x^2 - D^2*y^2 = N. A042965 covers the case D=1.
This sequence is also numbers that are congruent to {0,1,4,5,9,12,13} mod 16.
FORMULA
G.f.: x^2*(x+1)*(3*x+1)*(x^2-x+1)*(x^2+1) / ((x-1)^2*(x^6+x^5+x^4+x^3+x^2+x+1)).
a(n) ~ 16*n/7. - Stefano Spezia, Apr 08 2024
a(n) = 2*floor((4*n+1)/7) + floor((n+3)/7) + n. - Ridouane Oudra, Nov 24 2024
EXAMPLE
For N=33, the equation x^2 - 4*y^2 = 33 has solutions (X,Y) = (7,2) and (17,8).
MAPLE
seq(2*floor((4*n+1)/7)+floor((n+3)/7)+n, n=0..80); # Ridouane Oudra, Nov 24 2024
PROG
(PARI)
\\ Values of n for which the equation x^2 - d^2*y^2 = n has integer solutions.
\\ e.g. allpellsq(2, 20) gives [0, 1, 4, 5, 9, 12, 13, 16, 17, 20]
allpellsq(d, nmax) = {
local(v=[0], n, w);
for(n=1, nmax,
w=pellsq(d, n);
if(#w>0, v=concat(v, n))
);
v
}
\\ All integer solutions to x^2-d^2*y^2=n.
\\ e.g. pellsq(5, 5200) gives [265, 51; 140, 24; 85, 9]
pellsq(d, n) = {
local(m=Mat(), f, x, y);
fordiv(n, f,
if(f*f>n, break);
if((n-f^2)%(2*f*d)==0,
y=(n-f^2)\(2*f*d);
x=d*y+f;
m=concat(m, [x, y]~)
)
);
m~
}
CROSSREFS
Sequence in context: A059610 A341783 A319606 * A194154 A297291 A269741
KEYWORD
nonn,easy,changed
AUTHOR
Colin Barker, Oct 13 2013
STATUS
approved