%I #57 Oct 15 2018 05:18:01
%S 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,
%T 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,
%U 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
%N The characteristic function of square pyramidal numbers.
%C The n-th 1 is followed by n^2 - 1 zeros.
%C Run lengths of zeros gives A005563. - _Jeremy Gardiner_, Jan 14 2018
%C Square pyramidal numbers are of the form m(m+1)(2m+1)/6.
%C 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
%H Seiichi Manyama, <a href="/A253903/b253903.txt">Table of n, a(n) for n = 0..10000</a>
%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>
%t Flatten[Table[Join[{1},PadRight[{},n^2-1,0]],{n,10}]] (* _Harvey P. Dale_, Mar 05 2015 *)
%o (PARI) lista(nn) = {id = 0; while (id <= nn, print1(1, ", "); id++; for (k=1, id^2-1, print1(0, ", ");););} \\ _Michel Marcus_, Feb 20 2015
%o (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
%o (PARI) a(n) = my(m = sqrtnint(3*n, 3)); n==m*(m+1)*(2*m+1)/6 \\ _David A. Corneth_, Oct 14 2018
%Y Cf. A000330 (square pyramidal numbers), A282173.
%K nonn
%O 0
%A _Mikael Aaltonen_, Jan 18 2015
|