OFFSET
1,1
COMMENTS
Suppose that n has base-b digits b(m), b(m-1), ..., b(0). The base-b down-variation of n is the sum DV(n,b) of all d(i)-d(i-1) for which d(i) > d(i-1); the base-b up-variation of n is the sum UV(n,b) of all d(k-1)-d(k) for which d(k) < d(k-1). The total base-b variation of n is the sum TV(n,b) = DV(n,b) + UV(n,b). See the guide at A297330.
Differs from A071589 first at 1011 which is in A071589 but not in here because UV(1011) = DV(1011)=1. - R. J. Mathar, Jan 23 2018
LINKS
Clark Kimberling, Table of n, a(n) for n = 1..10000
EXAMPLE
198765 in base-10: 1,9,8,7,6,5, having DV = 4, UV = 8, so that 198765 is in the sequence.
MATHEMATICA
g[n_, b_] := Map[Total, GatherBy[Differences[IntegerDigits[n, b]], Sign]];
x[n_, b_] := Select[g[n, b], # < 0 &]; y[n_, b_] := Select[g[n, b], # > 0 &];
b = 10; z = 2000; p = Table[x[n, b], {n, 1, z}]; q = Table[y[n, b], {n, 1, z}];
w = Sign[Flatten[p /. {} -> {0}] + Flatten[q /. {} -> {0}]];
Take[Flatten[Position[w, -1]], 120] (* A297270 *)
Take[Flatten[Position[w, 0]], 120] (* A297271 *)
Take[Flatten[Position[w, 1]], 120] (* A297272 *)
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Clark Kimberling, Jan 16 2018
STATUS
approved