login
A253903
The characteristic function of square pyramidal numbers.
7
1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
OFFSET
0
COMMENTS
The n-th 1 is followed by n^2 - 1 zeros.
Run lengths of zeros gives A005563. - Jeremy Gardiner, Jan 14 2018
Square pyramidal numbers are of the form m(m+1)(2m+1)/6.
As pyramid(m) = m(m+1)(2m+1)/6 = m*(m+1/2)*(m+1)/3, (3 * pyramid(m))^(1/3) is slightly less than m + 1/2. - David A. Corneth, Oct 14 2018
MATHEMATICA
Flatten[Table[Join[{1}, PadRight[{}, n^2-1, 0]], {n, 10}]] (* Harvey P. Dale, Mar 05 2015 *)
PROG
(PARI) lista(nn) = {id = 0; while (id <= nn, print1(1, ", "); id++; for (k=1, id^2-1, print1(0, ", "); ); ); } \\ Michel Marcus, Feb 20 2015
(PARI) a(n) = {if (n <= 1, return (1)); my(s = 1, k = 2); while (s < n, s += k^2; k++); (s == n); } \\ Michel Marcus, Oct 14 2018
(PARI) a(n) = my(m = sqrtnint(3*n, 3)); n==m*(m+1)*(2*m+1)/6 \\ David A. Corneth, Oct 14 2018
CROSSREFS
Cf. A000330 (square pyramidal numbers), A282173.
Sequence in context: A359456 A012245 A256436 * A255849 A185059 A179776
KEYWORD
nonn
AUTHOR
Mikael Aaltonen, Jan 18 2015
STATUS
approved