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.

This page as a plain text file.
%I A307707 #45 Nov 17 2024 10:14:10
%S A307707 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,
%T A307707 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,
%U A307707 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
%N 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.
%C A307707 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)".
%C A307707 From _Paul Curtz_, Apr 27 2019: This can be written as a triangle:
%C A307707                     0
%C A307707                   1   1
%C A307707                 1   2   1
%C A307707               2   2   2   2
%C A307707             2   3   2   3   2
%C A307707           3   3   3   3   3   3
%C A307707         3   4   3   4   3   4   3
%C A307707 ...
%H A307707 Jean-Marc Falcoz, <a href="/A307707/b307707.txt">Table of n, a(n) for n = 1..11326</a>
%F A307707 a(n) + a(n+1) = A002024(n). - _Rémy Sigrist_, Apr 24 2019
%F A307707 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
%t A307707 m = 107; a[1]=0;
%t A307707 a24[n_] := Ceiling[(Sqrt[8n+1]-1)/2];
%t A307707 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 *)
%o A307707 (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
%Y A307707 Cf. A002024.
%Y A307707 Cf. also A007590, A057353, A106466 and A238410.
%Y A307707 For other versions see A307720 and A378117.
%K A307707 nonn,look
%O A307707 1,5
%A A307707 _Eric Angelini_ and _Jean-Marc Falcoz_, Apr 23 2019
%E A307707 Definition clarified by _Rémy Sigrist_ and _N. J. A. Sloane_, Nov 17 2024