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.

A386369 a(1) = 0, and for any n > 1, a(n) is the largest k < n such that a(1) + ... + a(k) is a square number.

Original entry on oeis.org

0, 1, 2, 2, 2, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 18, 18, 18, 18, 18, 18, 18, 18, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26
Offset: 1

Views

Author

Rémy Sigrist, Jul 19 2025

Keywords

Comments

In other words: a(1) = 0, and for any n > 0, if a(1) + ... + a(n) is a square number then a(n+1) = n, otherwise a(n+1) = a(n).
This sequence is unbounded: if a(1) + ... + a(n) = u^2, then a(n+1) = n, u^2 + n * (2*u+n) = (u+n)^2, so a(1) + ... + a(m) is a square number for some m > n, and a(m+1) = m > a(n+1).

Examples

			Sequence begins:
  n   a(n)  a(1)+...+a(n)  Square?
  --  ----  -------------  -------
   1     0              0  Yes
   2     1              1  Yes
   3     2              3  No
   4     2              5  No
   5     2              7  No
   6     2              9  Yes
   7     6             15  No
   8     6             21  No
   9     6             27  No
  10     6             33  No
		

Crossrefs

See A385986 for a similar sequence.

Programs

  • Mathematica
    Module[{s = 0,a = 0}, Table[If[IntegerQ[Sqrt[s += a]], a = n-1]; a, {n, 100}]] (* Paolo Xausa, Jul 29 2025, after Rémy Sigrist *)
  • PARI
    { t = 0; v = 0; for (n = 1, 70, print1 (v", "); t += v; if (issquare(t), v = n;);); }