cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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

Views

Author

Arnauld Chevallier, Nov 02 2020

Keywords

Comments

The sequence of 1's and 0's is more formally defined as A118175.

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)
   ...
		

Crossrefs

Based on A118175 and A000217.

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