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

A366631 Lexicographically earliest sequence such that each set of numbers enclosed by a pair of equal terms, excluding the endpoints, is distinct.

Original entry on oeis.org

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

Views

Author

Neal Gersh Tolunsky, Oct 14 2023

Keywords

Comments

The word 'set' means that every element is unique and order is irrelevant. {2,3}, for example, is equivalent to {3,2,2} and thus both could never appear in the sequence.
Two consecutive equal values enclose the empty set {}, and thus after [a(1), a(2)] = [1, 1] no consecutive equal values will occur again.
Note that we are considering sets between every pair of equal values, not just those that appear consecutively. For example, [2,1,2,3,2] encloses a set, which is {1,2,3}, as well as [2,3,2], which encloses {3}.
It appears that for n >= 21510, a(n + 17796) = a(n) + 2614 (found by Rémy Sigrist). If this linear recurrence is true, every number appears finitely many times.
A value k is banned after all the values in a set enclosed by a(i1) = a(i2) = k, with i1 < i2, and k itself have reoccurred in the sequence after a(i2). Suppose, for example, after the set S1 enclosed by a(i1) and a(i2) every element in S1 has appeared and also a(i3) = k, and then we had a(i4) = k. Then we would have a new set S2 enclosed by a(i2) and a(i4) that is a superset of S1 U {k}. This would contradict the sequence's definition since the set S2 enclosed by a(i2) and a(i4) is identical to the set S3 enclosed by a(i1) and a(i4) because S1 U {a(i2)} adds no new elements.
Assuming the linear recurrence above is true, the number 526 occurs a record number of 44 times in the sequence and it does not occur again after the linear recurrence begins. The same is true of three other values which occur 41, 42, and 43 times in the sequence.
For n > 2, a new value is always followed by the smallest number that has not yet been banned and is distinct from the previous number (i.e. does not form a null set).
If the definition is changed so that endpoints are included, this becomes A008619.

Examples

			a(2)=1, establishing the empty set, [1,1] -> {}.
a(4)=1, creating the sets [1,2,1] -> {2} and [1,1,2,1] -> {1,2}, which are distinct from any set that has appeared thus far. Note that 1 is now permanently banned since the next 1 would have to enclose the same set with a(1) as it would with a(2).
a(8)=4: a(8) cannot be 1 since 1 has been banned. 2 would form the empty set with a(7)=2. a(8) cannot be 3 since this would form the set [3,2,3] -> {2}, which already occurred as [1,2,1] -> {2}. a(8)=4 because 4 is a first occurrence and thus forms no sets.
For another example of a banned number, see the last occurrence of 2, which is a(9)=2. a(10) cannot be 2 since this would form the empty set. At a(11), the value 2 is banned forever since any further 2 would form the same set of numbers with a(7)=2 as with a(5)=2. This is because a later term paired with a(5)=2 would only add the values a(7)=2 and a(6)=3, in comparison to a pairing with a(7)=2, which already encloses a(9)=2 and a(10)=3.
		

Crossrefs

Programs

  • PARI
    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(set(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(), 75))) # Michael S. Branicky, Jan 15 2024

Extensions

More terms from Rémy Sigrist, Oct 15 2023
Edited by Peter Munn, Dec 05 2023

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
    

A367467 Lexicographically earliest infinite sequence of positive integers such that a(n + a(n)) is distinct for all n.

Original entry on oeis.org

1, 1, 2, 2, 3, 4, 2, 5, 6, 7, 1, 8, 9, 2, 10, 11, 12, 1, 13, 14, 2, 15, 16, 2, 17, 18, 19, 2, 20, 21, 2, 22, 23, 24, 1, 25, 26, 2, 27, 28, 2, 29, 30, 31, 2, 32, 33, 2, 34, 35, 36, 1, 37, 38, 2, 39, 40, 41, 1, 42, 43, 2, 44, 45, 2, 46, 47, 48, 1, 49, 50, 2, 51, 52, 53, 1, 54, 55, 2, 56, 57, 2, 58, 59, 60, 2, 61, 62, 2
Offset: 1

Views

Author

Neal Gersh Tolunsky, Nov 18 2023

Keywords

Comments

Consider each index i as a location from which one can jump a(i) terms forward. To find a(n) we have to check 2 conditions:
1. The value a(n) can be reached in one jump by at most one previous location.
2. Location n reaches a location in one jump that is not reached in one jump from a location before n.
Described in the above way, the sequence seems to be structured as follows:
A083051 appears to give the indices which cannot be reached from any earlier term; the terms at these indices are 1s and 2s.
A087057 appears to give the indices which can be reached from an earlier term; except for a(2), these terms are first occurrences.
From Thomas Scheuerle, Nov 26 2023: (Start)
Empirical observations:
It appears that this sequence consists of the natural numbers in ascending order interspersed by 1 and 2.
If we consider the distance between successive ones, we will observe a nonperiodic pattern: 9,7,17,17,7,10,7,17,7,10,... . It appears that there are only 7, 10 and 17 with the exception of 9 once.
If we consider the distance between successive twos, we will also observe an interesting nonperiodic pattern: 3,7,7,3,4,3,7,3,4,3,7,7,3,... . It appears that this pattern consists only of 3, 4 and 7. (End)

Examples

			Initial locations and the (by definition) distinct terms that they reach:
     n|  1  2  3  4  5  6  7  8  9
  a(n)|  1  1  2  2  3  4  2  5  6
          =>1=>2====>3
                   ====>4
                      =======>5
                            ====>6
When we evaluate a(i+a(i)) with each index i, we get a distinct value. When i=1, for example, a(1+a(1))=a(1+1)=a(2)=1;  no other i gives 1 as the solution to a(i+a(i)). When i=4, a(4+a(4))=a(4+2)=a(6)=4, and 4 is likewise a solution unique to i=4.
		

Crossrefs

Programs

  • MATLAB
    function a = A367467( max_n )
        a = [1 1:2*max_n];
        for n = 3:max_n
            a(n) = 1;
            while consistency(a, n) == false
                a(n) = a(n)+1;
            end
        end
        a = a(1:max_n);
    end
    function ok = consistency(a, n)
        v = a([1:n] + a(1:n));
        ok = (n == length(unique(v)));
    end % Thomas Scheuerle, Nov 21 2023

Formula

From Thomas Scheuerle, Nov 26 2023: (Start)
Conjectures:
a(n) = A049472(n) = floor(n*(1 + 1/sqrt(2))) - n, if n is not in A083051.
a(A083051(n)) = A184119(n+1) - A083051(n).
a(a(A083051(n)) + A083051(n)) + a(A083051(n)) + A083051(n) = A328987(n) = floor((a(A083051(n)) + A083051(n))*(1 + 1/sqrt(2))) = floor(A184119(n+1)*(1 + 1/sqrt(2))). (End)

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

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

Original entry on oeis.org

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

Views

Author

Neal Gersh Tolunsky, Nov 26 2024

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 1 term, and thus after [a(1), a(2)] = [1, 1], no consecutive equal values occur again.

Examples

			a(4) cannot be 1 since this would create a second pair enclosing two values, [1,2,1] being an equivalent set to [1,2,1,1]. We cannot have a(4)=2 because [1,2,1] would enclose the same number of elements as [2,1,2]. So a(4)=3, which has not occurred before.
		

Crossrefs

Cf. A366691.

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, ndset = True, an+1, set()
                for i in range(len(a)):
                    if an == a[i]:
                        nd = len(set(a[i:]))
                        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(), 73))) # Michael S. Branicky, Nov 26 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

A369422 Lexicographically earliest infinite sequence such that no two equal unordered pairs (a(j), a(k)) have the same distance abs(j-k).

Original entry on oeis.org

1, 1, 2, 3, 4, 2, 5, 6, 3, 7, 8, 4, 9, 10, 11, 5, 12, 13, 6, 14, 15, 16, 7, 17, 18, 8, 19, 20, 21, 9, 22, 23, 10, 24, 25, 11, 26, 27, 28, 12, 29, 30, 13, 31, 32, 33, 14, 34, 35, 15, 36, 37, 16, 38, 39, 40, 17, 41, 42, 18, 43, 44, 45, 19, 46, 47, 20, 48, 49, 21, 50, 51, 52, 22, 53, 54, 23, 55, 56, 57, 24, 58, 59, 25, 60, 61
Offset: 1

Views

Author

Neal Gersh Tolunsky, Jan 22 2024

Keywords

Comments

In other words: The absolute distance between the indices of any two terms (A and B) is distinct among all pairs of terms in the sequence with the same two values (A and B).
No value can occur more than twice: 1) If two terms have the same value, one term must be at an odd index and the other at an even index. Otherwise we would have a middle term B equidistant from two equal terms in an ABA-form progression, which contradicts the sequence's definition. 2) So we can have at most one term with a given value at an even index and one at an odd index.
Any unordered pair (A, B) has a maximum of 4 distinct distances (A1 to B1, A1 to B2, A2 to B1, A2 to B2).
For the equivalent sequence using ordered pairs, see A337226.

Examples

			a(7)=5: We cannot have a(7)=1 because then, for example, the unordered pair (1,2) would have the same absolute distance twice at distinct indices:
1, 1, 2, 3, 4, 2, 1
   1--2        2--1
a(7) could not equal 2 because again the pair (1,2) would have the same absolute distance twice at different indices (i=6-1=5 and i=7-2=5):
1, 1, 2, 3, 4, 2, 2
1--------------2
   1--------------2
a(7) cannot be 3 because of the following two equal unordered pairs, which would have the same distance:
1, 1, 2, 3, 4, 2, 3
      2--3     2--3
a(7) cannot be 4, or we would have two equal unordered pairs both with distance 1:
1, 1, 2, 3, 4, 2, 4
            4--2
               2--4
a(7) can be 5 without restriction since 5 is a first occurrence and every unordered pair with 5 has a distinct distance.
		

Crossrefs

Cf. A136119, A184119 (conjectured first and second occurrences).
Showing 1-7 of 7 results.