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-8 of 8 results.

A330897 a(n) is the least k such that A330896(k) = n.

Original entry on oeis.org

1, 3, 8, 12, 21, 35, 43, 71, 85, 107, 133, 138, 173, 220, 240, 290, 320, 355, 405, 430, 512, 559, 593, 622, 727, 731, 846, 901, 940, 1071, 1107, 1207, 1279, 1389, 1490, 1544, 1657, 1699, 1768, 1870, 1935, 2049, 2198, 2346, 2468, 2478, 2612, 2693, 2817, 2919
Offset: 1

Views

Author

Rémy Sigrist, May 01 2020

Keywords

Examples

			The first terms of A330896 are:
           n|  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 ...
  A330896(n)|  1  1  2  1  2  2  1  3  2  3  1  4  2  3  3  1  4  2  4  3  5 ...
- hence a(1) = 1, a(2) = 3, a(3) = 8, a(4) = 12, a(5) = 21.
		

Crossrefs

Cf. A330896.

Programs

  • C
    See Links section.

Formula

A330896(a(n)) = n.

A366493 Lexicographically earliest sequence such that each subsequence enclosed by two equal terms is distinct.

Original entry on oeis.org

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

Views

Author

Neal Gersh Tolunsky, Oct 10 2023

Keywords

Comments

A new value is always followed by 1.

Examples

			a(2)=1 because the subsequence (1,1) has not occurred before.
a(8)=3 because every smaller number would form a subsequence that has occurred already. a(8) cannot be 1 because this would make the subsequence (1,1), which was seen before at i=1,2. a(8) cannot be 2 because then we would have the subsequence (2,1,2) for a second time (first at i=3-5): 1,1,2,1,2,2,1,2
		

Crossrefs

Cf. A330896.

Programs

  • MATLAB
    See Links section.
    
  • Python
    from itertools import islice
    def agen(): # generator of terms
        m, a = set(), []
        while True:
            an, allnew = 0, False
            while not allnew:
                allnew, an, mn = True, an+1, set()
                for i in range(len(a)):
                    if an == a[i]:
                        t = tuple(a[i:]+[an])
                        if t in m or t in mn: allnew = False; break
                        mn.add(t)
            yield an; a.append(an); m |= mn
    print(list(islice(agen(), 111))) # Michael S. Branicky, Dec 06 2024

A366691 Lexicographically earliest sequence such that each set of terms enclosed by two equal values, excluding the endpoints, contains a distinct number of elements.

Original entry on oeis.org

1, 1, 2, 1, 3, 4, 2, 5, 6, 3, 7, 4, 8, 2, 9, 5, 10, 11, 6, 12, 3, 13, 14, 7, 15, 4, 16, 17, 8, 18, 2, 19, 20, 21, 9, 22, 5, 23, 24, 10, 25, 11, 26, 6, 27, 28, 12, 29, 30, 13, 31, 14, 32, 7, 33, 15, 34, 35, 36, 16, 37, 17, 38, 8, 39, 18, 40, 41, 19, 42, 43, 20
Offset: 1

Views

Author

Neal Gersh Tolunsky, Oct 17 2023

Keywords

Comments

The word 'set' means that every element is unique. For example, the set {1,1,2} contains 2 elements (not 3).
Note that we are considering sets between every pair of equal values, not just those that appear consecutively.
Two consecutive values enclose 0 terms, and thus after [a(1), a(2)] = [1, 1], no consecutive equal values occur again.

Examples

			a(1)=1; no pair of terms exists yet.
a(2)=1 creates the pair [1, 1], which encloses 0 elements. This means that no consecutive equal values can occur again, since this would create another set of 0 elements.
a(3)=2 because if a(3)=1, this would create a second pair enclosing 0 elements.
a(4)=1 creates two new sets: [1, 2, 1], enclosing 1 element {2}, and [1, 1, 2, 1], enclosing 2 elements {1, 2}.
a(5) cannot be 1 as this would again create a pair enclosing 0 elements [1,1]. 2 would create the pair [2, 1, 2] which encloses 1 element {1}, which has been impossible since a(4). So a(5)=3, which has not occurred before.
		

Crossrefs

Cf. A337226 (with nondistinct terms counted), A330896, A363757, A366631.

Programs

  • PARI
    See Links section.
    
  • Python
    from itertools import islice
    def agen(): # generator of terms
        e, a = set(), []
        while True:
            an, allnew = 0, False
            while not allnew:
                allnew, an, ndset = True, an+1, set()
                for i in range(len(a)):
                    if an == a[i]:
                        nd = len(set(a[i+1:]))
                        if nd in e or nd in ndset: allnew = False; break
                        ndset.add(nd)
            yield an; a.append(an); e |= ndset
    print(list(islice(agen(), 72))) # Michael S. Branicky, Oct 25 2023

Extensions

More terms from Rémy Sigrist, Oct 25 2023

A363757 Lexicographically earliest sequence of positive integers such that the n-th pair of consecutive equal values are separated by a(n) distinct terms, with pairs numbered according to the position of the second term in the pair.

Original entry on oeis.org

1, 2, 1, 3, 2, 3, 4, 1, 3, 2, 5, 4, 5, 3, 4, 6, 1, 5, 2, 6, 4, 7, 3, 7, 5, 3, 1, 4, 8, 2, 1, 6, 3, 2, 3, 8, 9, 7, 8, 7, 1, 9, 7, 8, 5, 10, 4, 3, 2, 9, 2, 6, 8, 7, 3, 11, 1, 8, 3, 1, 10, 3, 6, 9, 7, 3, 12, 5, 12, 8, 3, 8, 2, 12, 9, 1, 7, 12, 13, 4, 9, 11, 8, 4, 2, 8, 10, 1, 10, 13, 6
Offset: 1

Views

Author

Neal Gersh Tolunsky, Jun 23 2023

Keywords

Comments

The word 'distinct' differentiates this sequence from A363654.
A000124 gives the index of the first occurrence of n, and A080036 gives the indices of the remaining terms. A record high term occurs when its corresponding pair number would be the previous record high, since that would have to use all terms between the enclosing pair, which is impossible.
A083920(n) gives the number of pairs in the first n terms of this sequence.
If pairs are numbered according to the position of the first term in the pair (rather than second), this becomes A001511 (the ruler function).

Examples

			The 1st pair (1,2,1) encloses 1 term because a(1)=1.
The 2nd pair (2,1,3,2) encloses 2 distinct terms because a(2)=2.
The 3rd pair (3,2,3) encloses 1 term because a(3)=1.
The 4th pair (1,3,2,3,4,1) encloses 3 distinct terms because a(4)=3.
a(4)=3 since if we place a 1 or a 2 (creating the second pair), this would enclose less than a(2)=2 distinct terms, so a(4) must be the smallest unused number, which is 3.
		

Crossrefs

A366624 Lexicographically earliest sequence of positive integers such that each subsequence enclosed by two equal terms, not including the endpoints, is distinct.

Original entry on oeis.org

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

Views

Author

Samuel Harkness, Oct 14 2023

Keywords

Comments

Every positive integer occurs infinitely many times in the sequence.
The subsequence between any two equal terms is unique. For example, consecutive values "A B A" prevents "C B C" because the subsequence "B" would be repeated between equal terms.
Two consecutive values create the empty subsequence, for this reason after {a(1), a(2)} = {1, 1}, no consecutive values will ever occur again.
A new value is always followed by 1.

Examples

			For a(9), we first try 1. If a(9) were 1, {a(8)} = {2} would be bounded by a(7) = a(9) = 1, but {2} is already bounded by a(2) = a(4) = 1.
Next, try 2. Note this would create consecutive values at {a(8), a(9)}, enclosing the empty subsequence, but this already occurred at {a(1), a(2)}.
Next, try 3. If a(9) were 3, {a(7), a(8)} = {1, 2} would be bounded by a(6) = a(9) = 3, but {1, 2} is already bounded by a(1) = a(4) = 1.
Next, try 4. 4 has yet to appear, so a(9) = 4.
		

Crossrefs

Cf. A366625 (with distinct multisets), A366631 (with distinct sets), A366493 (including endpoints), A330896, A366691.

Programs

  • C
    /* See links */
  • MATLAB
    See Links section.
    
  • Python
    from itertools import islice
    def agen(): # generator of terms
        m, a = set(), []
        while True:
            an, allnew = 0, False
            while not allnew:
                allnew, an, mn = True, an+1, set()
                for i in range(len(a)):
                    if an == a[i]:
                        t = tuple(a[i+1:])
                        if t in m or t in mn: allnew = False; break
                        mn.add(t)
            yield an; a.append(an); m |= mn
    print(list(islice(agen(), 87))) # Michael S. Branicky, Jan 15 2024
    

A366625 Lexicographically earliest sequence of positive integers such that each multiset enclosed by two equal terms, excluding the endpoints, is distinct.

Original entry on oeis.org

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

Views

Author

Samuel Harkness, Oct 14 2023

Keywords

Comments

Every positive integer occurs infinitely many times in the sequence.
The multiset between any two equal terms is unique. For example: once consecutive values "A B C A" occur, both "D B C D" and "D C B D" can never occur, because the multiset "B C" would be repeated between equal terms.
Two consecutive values enclose the empty multiset. For this reason, after [a(1), a(2)] = [1, 1], no consecutive equal values will occur again.
A new value is always followed by 1.
The sequence first differs from A366624 at a(15).

Examples

			a(15) = 5: a(15) cannot be 1 since this would form the empty multiset with a(14) = 1. a(15) cannot be 2 because this would form the multiset [2 1 2] = {1}, which already occurred at [2 1 2] = {1}. a(15) cannot be 3 because this would form the multiset [3 2 1 3] = {1, 2}, which already occurred at [1 1 2 1] = {1, 2}. a(15) cannot be 4 because this would form the multiset [4 1 2 3 2 1 4] = {1, 1, 2, 2, 3}, which already occurred at [1 1 2 1 2 3 1] = {1, 1, 2, 2, 3}. a(15) = 5 because 5 is a first occurrence and thus creates no new multisets.
For this sequence, the multisets between k and all other occurrences of k must be checked. The first instance such that this is the sole reason for restricting a possible value is when considering 2 for a(27).
a(27) != 2 since 2 there would cause two enclosed multisets with the same 5 terms (in different order, which doesn't matter for a multiset),
  n    =   15      19    22      26 27
  a(n) =  1 5 1 2 3 4 1 2 3 4 2 1 5 [2]
            |-------|     |-------|
There are also instances where overlapping conflicting regions are the sole reason for restricting a possible value.
a(74) != 5 since 5 there would cause two enclosed multisets with the same 20 terms,
  n    =  38                              54
  a(n) = 2 6 1 2 3 4 5 1 2 4 3 7 1 2 3 4 5 3 1
           |----------------------------------
                                           |--
  n    =  57                              73
  a(n) = 2 6 2 1 3 4 5 7 1 2 3 4 5 6 1 2 3 4[5]
         --|
         ----------------------------------|
		

Crossrefs

Programs

  • MATLAB
    See Links section.
    
  • Python
    from itertools import islice
    def agen(): # generator of terms
        m, a = set(), []
        while True:
            an, allnew = 0, False
            while not allnew:
                allnew, an, mn = True, an+1, set()
                for i in range(len(a)):
                    if an == a[i]:
                        t = tuple(sorted(a[i+1:]))
                        if t in m or t in mn: allnew = False; break
                        mn.add(t)
            yield an; a.append(an); m |= mn
    print(list(islice(agen(), 87))) # Michael S. Branicky, Oct 25 2023

A370577 Lexicographically earliest sequence such that for any value m, the number of distinct values between a pair of consecutive m's is distinct.

Original entry on oeis.org

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

Views

Author

Neal Gersh Tolunsky, Feb 22 2024

Keywords

Examples

			The first terms with the number of distinct values enclosed by m = 1..4 below:
   n|  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
...
a(n)|  1  1  2  1  2  2  3  1  2  3  3  4  1  2  3  4  3  4  4  5  1  2  3
...
----+---------------------------------------------------------------------
 1's|     0,    1,          2,             3,                      4,
...
 2's|              1, 0,       2,             3,                      4,
...
 3's|                             2, 0,          3,    1,                4,
...
 4's|                                               3,    1, 0,
...
		

Crossrefs

Programs

  • Python
    from itertools import islice
    def agen(): # generator of terms
        e, a = set(), []
        while True:
            an, allnew = 0, False
            while not allnew:
                allnew, an, nd = True, an+1, None
                for i in range(len(a)-1, -1, -1):
                    if an == a[i]:
                        nd = len(set(a[i+1:]))
                        if (an, nd) in e: allnew = False
                        break
            yield an; a.append(an); e.add((an, nd))
    print(list(islice(agen(), 86))) # Michael S. Branicky, Feb 22 2024

Extensions

More terms from Michael S. Branicky, Feb 22 2024

A379381 a(1)=1, a(2)=2; thereafter, a(n) is the smallest positive integer such that for any value k, the number of distinct values between a pair of k's is distinct, counting k itself.

Original entry on oeis.org

1, 2, 1, 2, 3, 3, 4, 2, 4, 5, 5, 6, 4, 6, 7, 2, 6, 7, 8, 7, 8, 9, 9, 10, 6, 8, 10, 11, 10, 11, 12, 2, 11, 12, 13, 8, 13, 14, 11, 12, 13, 14, 15, 14, 15, 16, 16, 17, 2, 13, 15, 17, 18, 8, 15, 18, 19, 17, 19, 20, 17, 18, 20, 21, 20, 21, 22, 22, 23, 18, 21, 23, 24
Offset: 1

Views

Author

Neal Gersh Tolunsky, Dec 21 2024

Keywords

Comments

Note that we are considering every pair of equal values, not just those that appear consecutively.

Examples

			a(7)=4: We cannot have a(7)=1 here because this would make a(1..7) = 1, 2, 1, 2, 3, 3, 1 enclose the same number of terms as a(3..7) = 1, 2, 3, 3, 1 (3 distinct values). We cannot have a(7)=2 because this would mean a(4..7) = 2, 3, 3, 2 encloses 2 values, which we had at a(2..4) = 2, 1, 2. a(7) cannot be 3 because this would repeat a(5-6) = 3, 3 with a(6-7) = 3, 3, again enclosing 1 distinct value. So a(7) = 4 without restriction.
		

Crossrefs

Showing 1-8 of 8 results.