login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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.
1
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,2
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.
FORMULA
|a(n+1) - a(n)| = 1.
EXAMPLE
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.
PROG
(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))
CROSSREFS
Sequence in context: A176846 A144735 A304734 * A202275 A030307 A175792
KEYWORD
nonn,look
AUTHOR
Bryle Morga, Jul 29 2024
STATUS
approved