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.

A307707 Lexicographically earliest sequence of nonnegative integers in which, for all k >= 0, there are exactly k pairs of consecutive terms whose sum is k.

Original entry on oeis.org

0, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8
Offset: 1

Views

Author

Eric Angelini and Jean-Marc Falcoz, Apr 23 2019

Keywords

Comments

The old definition was "Lexicographically earliest sequence starting with a(1) = 0 such that a(n) is the number of pairs of contiguous terms whose sum is a(n)".
From Paul Curtz, Apr 27 2019: This can be written as a triangle:
0
1 1
1 2 1
2 2 2 2
2 3 2 3 2
3 3 3 3 3 3
3 4 3 4 3 4 3
...

Crossrefs

Cf. A002024.
Cf. also A007590, A057353, A106466 and A238410.
For other versions see A307720 and A378117.

Programs

  • Mathematica
    m = 107; a[1]=0;
    a24[n_] := Ceiling[(Sqrt[8n+1]-1)/2];
    Array[a, m] /. Solve[Table[a[n] + a[n+1] == a24[n], {n, 1, m-1}]][[1]] (* Jean-François Alcover, Jun 02 2019, after Rémy Sigrist's formula *)
  • PARI
    v=0; rem=wanted=1; for (n=1, 107, print1 (v", "); v=wanted-v; if (rem--==0, rem=wanted++)) \\ Rémy Sigrist, Apr 23 2019

Formula

a(n) + a(n+1) = A002024(n). - Rémy Sigrist, Apr 24 2019
Let t_m = m*(m+1)/2. Write n = t_m - i with m >= 1 and 0 <= i < m. Then a(n) = m/2 if m is even, or if m is odd, a(n) = (m-1)/2 + (i-1 mod 2). - N. J. A. Sloane, Nov 16 2024

Extensions

Definition clarified by Rémy Sigrist and N. J. A. Sloane, Nov 17 2024