OFFSET
0,3
LINKS
Eric Weisstein's World of Mathematics, Square Pyramidal Number
EXAMPLE
819 is the smallest square pyramidal number with binary weight 6 (819_10 = 1100110011_2), so a(6) = 819.
MAPLE
V:= Array(0..40): count:= 0:
for k from 1 while count < 40 do
m:= k*(k+1)*(2*k+1)/6;
w:= convert(convert(m, base, 2), `+`);
if w <= 40 and V[w] = 0 then
count:= count+1; V[w]:= m;
fi
od:
convert(V, list); # Robert Israel, Dec 26 2022
MATHEMATICA
seq[len_, nmax_] := Module[{s = Table[0, {len}], n = 0, c = 0, bw, sp}, While[c < len && n < nmax, bw = DigitCount[sp = n*(n+1)*(2*n+1)/6, 2, 1] + 1; If[bw <= len && s[[bw]] == 0, c++; s[[bw]] = sp]; n++]; s]; seq[31, 10^6] (* Amiram Eldar, Dec 26 2022 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Ilya Gutkovskiy, Dec 25 2022
STATUS
approved