login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A155708
Numbers expressible as a^2 + k*b^2 with nonzero integers a,b, for k=2, k=3 and k=5.
2
36, 129, 144, 201, 241, 324, 409, 441, 489, 516, 576, 601, 769, 804, 849, 900, 921, 964, 1009, 1129, 1161, 1201, 1249, 1296, 1321, 1489, 1521, 1569, 1609, 1636, 1641, 1764, 1801, 1809, 1849, 1929, 1956, 2064, 2089, 2161, 2169, 2281, 2304, 2361, 2404, 2521
OFFSET
1,1
LINKS
MAPLE
N:= 10000: # to get all terms <= N
S[2]:= {}: S[3]:= {}: S[5]:= {}:
for a from 1 to floor(sqrt(N)) do
for k in [2, 3, 5] do
S[k]:= S[k] union {seq(a^2 + k*b^2, b = 1 .. floor(sqrt((N-a^2)/k)))}
od
od:
R:= S[2] intersect S[3] intersect S[5]:
sort(convert(R, list)); # Robert Israel, Jul 11 2018
PROG
(PARI) isA155708(n, /* optional 2nd arg allows us to get other sequences */c=[5, 3, 2]) = { for(i=1, #c, for(b=1, sqrtint((n-1)\c[i]), issquare(n-c[i]*b^2) & next(2)); return); 1}
for(n=1, 9999, isA155708(n) & print1(n", "))
KEYWORD
nonn
AUTHOR
M. F. Hasler, Feb 10 2009
STATUS
approved