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.
LINKS
Bryle Morga, Table of n, a(n) for n = 1..16384
Bryle Morga, Visualization of the first 10,000,000 terms.
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
KEYWORD
nonn,look
AUTHOR
Bryle Morga, Jul 29 2024
STATUS
approved