login
A297250
Numbers whose base-3 digits having equal up-variation and down-variation; see Comments.
6
1, 2, 4, 8, 10, 13, 16, 20, 23, 26, 28, 31, 34, 37, 40, 43, 46, 49, 52, 56, 59, 62, 65, 68, 71, 74, 77, 80, 82, 85, 88, 91, 94, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, 145, 148, 151, 154, 157, 160, 164, 167, 170, 173
OFFSET
1,2
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.
LINKS
EXAMPLE
173 in base-3: 2,0,1,0,2, having DV = 3, UV = 3, so that 173 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 = 3; 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] (* A297249 *)
Take[Flatten[Position[w, 0]], 120] (* A297250 *)
Take[Flatten[Position[w, 1]], 120] (* A297251 *)
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Clark Kimberling, Jan 15 2018
STATUS
approved