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.

Showing 1-2 of 2 results.

A281579 Lexicographically earliest sequence such that, for any n>0, a(n)=length of the n-th run of consecutive terms in arithmetic progression in this sequence.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Jan 29 2017

Keywords

Comments

Runs of consecutive terms in arithmetic progression overlap: the last term of the n-th run corresponds to the first term of the (n+1)-st run.
See A281772 for the common difference of the n-th run of consecutive terms in arithmetic progression.
See A281783 for the index of the first term of the n-th run of consecutive terms in arithmetic progression.
See A281900 for the index of the first occurrence of n in the sequence.
We can show that:
1) a(n)>=2 for any n>0,
2) a(n+1)<=a(n)+1 for any n>0,
3) runs of consecutive 2's have at least length 2.
Conjectures:
4) there are infinitely many runs of consecutive 2's,
5) the sequence is unbounded.
This sequence has connections with the Kolakoski sequence (A000002) and Golomb's sequence (A001462) in the sense that they all establish a link between their terms and the lengths of inner runs.
This sequence has similarities with A113138. - Rémy Sigrist, Feb 08 2017
A380317 is an essentially identical sequence. - N. J. A. Sloane, Feb 17 2025

Examples

			a(1)=2 fits the definition (and a(1)=1 would not, because whatever a(2) is, (a(1),a(2)) is an arithmetic progression of length 2).
a(2)=2 also fits the definition.
(a(1), a(2)) constitutes the first run, and has length a(1)=2.
a(3) cannot equal 2 (as it would extend the previous run).
a(3)=3 fits the definition.
(a(2),a(3)) constitutes the second run, and has length a(2)=2.
a(4) cannot equal 2 (as a(5) would be equal to 1, which is impossible).
a(4)=3 fits the definition.
We complete the 3rd run with a(5)=3.
		

Crossrefs

A380317 The lexicographically earliest sequence of positive numbers which is identical to the run lengths of its first differences.

Original entry on oeis.org

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

Views

Author

Dominic McCarty, Feb 13 2025

Keywords

Comments

34 is the smallest value that does not appear in the first 10000 terms.
Conjecture: Every positive integer eventually appears.
Shortly after submitting this sequence the author, Dominic McCarty, discovered that it is almost identical to A281579: in fact, a(n) = A281579(n) - 1 for all n. However, since A281579 has seniority and the present sequence has a simpler definition and is more likely to be searched for, it has been decided to retain both entries. - N. J. A. Sloane, Feb 17 2025
The index of n in the present sequence is given by A281900(n+1).

Examples

			The sequence of first differences (where the n-th term is a(n+1)-a(n)) is:
0, 1, 0, 0, 1, 1, -1, -1, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, 0, 0, ...
The run lengths of consecutive values are:
1, 1, 2, 2, 2, 3, 4, 3, 2, ...
Which is the original sequence.
		

Crossrefs

Programs

  • Python
    from itertools import groupby
    def runs(l): return [len(list(group)) for i, group in groupby(l)]
    def firstDifs(l): return [l[i]-l[i-1] for i in range(1,len(l))]
    a = [1,1]
    while len(runs(firstDifs(a))) <= 100:
        a.append(1)
        b, m = runs(firstDifs(a)), max(firstDifs(a))
        while not (all(b[n] == a[n] for n in range(len(b)-1)) and b[-1] <= a[len(b)-1]):
            a[-1] += 1
            if a[-1] > m+a[-2]+1: a.pop(); a[-1] += 1 #Backtracking needed
            b = runs(firstDifs(a))
    print(a[:len(runs(firstDifs(a)))])
Showing 1-2 of 2 results.