A338546 For n > 0, a(n) is the number of 1's among the first T(n) terms of the sequence 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, ..., k 1's, k 0's, where T(n) is the n-th triangular number.
1, 2, 3, 6, 9, 11, 15, 21, 24, 28, 36, 42, 46, 55, 65, 70, 78, 91, 99, 105, 120, 133, 140, 153, 171, 180, 190, 210, 225, 234, 253, 275, 285, 300, 325, 341, 352, 378, 402, 414, 435, 465, 481, 496, 528, 553, 567, 595, 630, 645, 666, 703, 728, 744, 780, 816
Offset: 1
Keywords
Examples
Equivalently, this is the number of 1's up to the n-th row of a triangle filled with A118175: 1 (1) 01 (2) 100 (3) 1110 (6) 00111 (9) 100001 (11) 1111000 (15) 00111111 (21) 000000111 (24) 1111000000 (28) 01111111100 (36) 000000111111 (42) ...
Programs
-
Mathematica
With[{nn = 56}, Accumulate@ Map[Total, TakeList[Array[1 - Ceiling[#] + Round[#] &@ Sqrt[#] &, PolygonalNumber[nn]], Range[nn]]]] (* Michael De Vlieger, Nov 02 2020, after Branko Curgus at A118175 *)
-
PARI
f(n) = my(r=sqrt(n)); 1 - ceil(r) + round(r); a(n) = sum(k=1, n*(n+1)/2, f(k)==1); \\ Michel Marcus, Nov 12 2020
Comments