%I #4 Jan 15 2018 15:31:34
%S 1,2,4,8,10,13,16,20,23,26,28,31,34,37,40,43,46,49,52,56,59,62,65,68,
%T 71,74,77,80,82,85,88,91,94,97,100,103,106,109,112,115,118,121,124,
%U 127,130,133,136,139,142,145,148,151,154,157,160,164,167,170,173
%N Numbers whose base-3 digits having equal up-variation and down-variation; see Comments.
%C 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.
%H Clark Kimberling, <a href="/A297250/b297250.txt">Table of n, a(n) for n = 1..10000</a>
%e 173 in base-3: 2,0,1,0,2, having DV = 3, UV = 3, so that 173 is in the sequence.
%t g[n_, b_] := Map[Total, GatherBy[Differences[IntegerDigits[n, b]], Sign]];
%t x[n_, b_] := Select[g[n, b], # < 0 &]; y[n_, b_] := Select[g[n, b], # > 0 &];
%t b = 3; z = 2000; p = Table[x[n, b], {n, 1, z}]; q = Table[y[n, b], {n, 1, z}];
%t w = Sign[Flatten[p /. {} -> {0}] + Flatten[q /. {} -> {0}]];
%t Take[Flatten[Position[w, -1]], 120] (* A297249 *)
%t Take[Flatten[Position[w, 0]], 120] (* A297250 *)
%t Take[Flatten[Position[w, 1]], 120] (* A297251 *)
%Y Cf. A297249, A297251, A297330.
%K nonn,base,easy
%O 1,2
%A _Clark Kimberling_, Jan 15 2018
|