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.

A370408 Lexicographically earliest sequence of positive integers such that no three equal terms appear at distinct indices that are the side lengths of a triangle.

Original entry on oeis.org

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

Views

Author

Neal Gersh Tolunsky, Feb 17 2024

Keywords

Comments

In a triangle, the sum of any two side lengths is greater than that of the third, so that x + y > z.
So if x < y and a(x) = a(y) = t then we cannot have a(z) = t for any z in the range y < z < x+y.
Another way to construct the sequence: Place 1's at the earliest permitted positions (in this case, at Fibonacci indices). Each subsequent value (2’s, 3’s, etc.) is placed at the earliest permitted indices not already occupied by a smaller value. For example, 3's could be placed in a Fibonacci pattern beginning with 7, 9 (7, 9, 16, 25, etc.), but i=7+9=16 is already occupied by the value 2, so 3 gets the next smallest position i=17. i=9+17=26 is again occupied by a 2, so we give 3 the next smallest unoccupied position i=27.

Crossrefs

Cf. A367196, A107572 (triangle side lengths), A100480.

Programs

  • Mathematica
    list={1};Do[k=1;While[lst=Join[list,{k}];!And@@(And@@(({a,b,c}=#;(-a+b+c)(a-b+c)(a+b-c))<=0&/@Subsets[Flatten[Position[lst,#]],{3}])&/@Union@lst),k++];AppendTo[list,k],{n,92}];list (* Giorgos Kalogeropoulos, Feb 20 2024 *)
  • Python
    from itertools import combinations as C, count, islice
    def agen(): # generator of terms
        yield from [1, 1, 1]
        sides = {1: [1, 2, 3]}
        for n in count(4):
            an = next(an for an in count(1) if an not in sides or all(not all((nMichael S. Branicky, Feb 24 2024

Extensions

More terms from Giorgos Kalogeropoulos, Feb 20 2024