OFFSET
0,2
COMMENTS
A "low point" in a sequence is a term which is less than the previous term (this condition is skipped for the initial term) and which is followed by two or more increases.
FORMULA
a(n) = A135025(n-1)-1.
MAPLE
blocks := proc(a, S) local b, c, d, M, L, n;
# Given a list a, whose leading term has index S, return [b, c, d], where b lists the indices of the low points in a, c lists the values of a at the low points, and d lists the length of runs between the low points.
b:=[]; c:=[]; d:=[]; L:=1;
# is a[1] a low point?
n:=1;
if( (a[n+1]>a[n]) and (a[n+2]>a[n+1]) ) then
b:=[op(b), n+S-1]; c:=[op(c), a[n]]; d:=[op(d), n-L]; L:=n; fi;
for n from 2 to nops(a)-2 do
# is a[n] a low point?
if( (a[n-1]>a[n]) and (a[n+1]>a[n]) and (a[n+2]>a[n+1]) ) then
b:=[op(b), n+S-1]; c:=[op(c), a[n]]; d:=[op(d), n-L]; L:=n; fi; od;
[b, c, d]; end;
# Let a := [0, 2, 5, 0, 7, 18, 5, 22, 3, 26, 55, 24, ...]; be a list of the first terms in A008348
blocks(a, 0)[1]; # the present sequence
blocks(a, 0)[2]; # A324782
blocks(a, 0)[3]; # A324783
CROSSREFS
KEYWORD
nonn,more
AUTHOR
N. J. A. Sloane, Sep 01 2019
EXTENSIONS
a(17)-a(28) from Giovanni Resta, Oct 02 2019
Modified definition to make offset 0. - N. J. A. Sloane, Oct 02 2019
STATUS
approved