# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a155708 Showing 1-1 of 1 %I A155708 #9 Jul 11 2018 04:32:31 %S A155708 36,129,144,201,241,324,409,441,489,516,576,601,769,804,849,900,921, %T A155708 964,1009,1129,1161,1201,1249,1296,1321,1489,1521,1569,1609,1636,1641, %U A155708 1764,1801,1809,1849,1929,1956,2064,2089,2161,2169,2281,2304,2361,2404,2521 %N A155708 Numbers expressible as a^2 + k*b^2 with nonzero integers a,b, for k=2, k=3 and k=5. %H A155708 Robert Israel, Table of n, a(n) for n = 1..10000 %p A155708 N:= 10000: # to get all terms <= N %p A155708 S[2]:= {}: S[3]:= {}: S[5]:= {}: %p A155708 for a from 1 to floor(sqrt(N)) do %p A155708 for k in [2,3,5] do %p A155708 S[k]:= S[k] union {seq(a^2 + k*b^2, b = 1 .. floor(sqrt((N-a^2)/k)))} %p A155708 od %p A155708 od: %p A155708 R:= S[2] intersect S[3] intersect S[5]: %p A155708 sort(convert(R,list)); # _Robert Israel_, Jul 11 2018 %o A155708 (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} %o A155708 for(n=1,9999, isA155708(n) & print1(n",")) %Y A155708 Cf. A155715, A028372, A000404, A154777, A092572, A097268, A154778, A155707-A155716, A155560-A155578. %K A155708 nonn %O A155708 1,1 %A A155708 _M. F. Hasler_, Feb 10 2009 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE