|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
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
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|