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.

A375088 Mountain Sequence: Sequence that when expressed as non-overlapping mountains, the n-th term is the height and base of the n-th mountain.

Original entry on oeis.org

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

Views

Author

Bryle Morga, Jul 29 2024

Keywords

Comments

A mountain with base b and height h is a segment starting with b, then climbs to b+h, and goes back to b. So as an example, (1, 2, 3, 2, 1) is a mountain with base of 1 and height of 2.
All positive integers appear in the sequence infinitely many times.

Examples

			a(1) = 1, so the first non-overlapping mountain is 1, 2, 1 with h = b = 1.
Now, a(2) = 2, so the mountain 2, 3, 4, 3, 2 with b = h = 2 is appended to the sequence, and so on.
		

Programs

  • Python
    from itertools import islice
    def mountain(h):
        return list(range(h, 2*h + 1)) + list(range(2*h-1, h-1, -1))
    def agen():
        a = [1, 2, 1]
        yield 1
        i = 1
        while 1:
           a += mountain(a[i])
           yield a[i]
           i += 1
    print(islice(agen(), 104))

Formula

|a(n+1) - a(n)| = 1.