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”).
%I #13 Jan 18 2022 02:25:50
%S 0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,2,2,2,2,2,1,2,2,2,2,2,2,2,
%T 2,1,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,1,2,2,2,1,1,2,2,2,2,2,1,2,3,3,3,3,
%U 3,2,2,3,3,3,2,3,3,3,3,3,3,3,3,2,1,2
%N Number of pieces in the list d(m), d(m-1), ..., d(0) of base-4 digits of n; see Comments.
%C The definition of "piece" starts with the base-b digits d(m), d(m-1), ..., d(0) of n. First, an *ascent* is a list (d(i), d(i-1), ..., d(i-h)) such that d(i) < d(i-1) < ... < d(i-h), where d(i+1) >= d(i) if i < m, and d(i-h-1) >= d(i-h) if i > h. A *descent* is a list (d(i), d(i-1), ..., d(i-h)) such that d(i) > d(i-1) > ... > d(i-h), where d(i+1) <= d(i) if i < m, and d(i-h-1) <= d(i-h) if i > h. A *flat* is a list (d(i), d(i-1), ..., d(i-h)), where h > 0, such that d(i) = d(i-1) = ... = d(i-h), where d(i+1) != d(i) if i < m, and d(i-h-1) != d(i-h) if i > h. A *piece* is an ascent, a descent, or a flat. Example: 235621103 has five pieces: (2,3,5,6), (6,2,1), (1,1), (1,0), and (0,3); that's 2 ascents, 2 descents, and 1 flat. For every b, the "piece sequence" includes every positive integer infinitely many times. See A297030 for a guide to related sequences.
%H Clark Kimberling, <a href="/A297032/b297032.txt">Table of n, a(n) for n = 1..10000</a>
%e Base-4 digits for 123: 1,3,2,3, so that a(123) = 3.
%t a[n_, b_] := Length[Map[Length, Split[Sign[Differences[IntegerDigits[n, b]]]]]];
%t b = 4; Table[a[n, b], {n, 1, 120}]
%Y Cf. A297030 (pieces), A296712 (rises and falls), A296882 (pits and peaks).
%K nonn,easy,base
%O 1,16
%A _Clark Kimberling_, Jan 13 2018