%I
%S 3,6,7,9,12,15,18,19,21,22,24,25,27,30,33,36,39,42,45,48,51,54,55,57,
%T 58,60,61,63,64,66,67,69,70,72,73,75,76,78,79,81,84,87,90,93,96,99,
%U 102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147
%N Numbers whose base3 digits have greater downvariation than upvariation; see Comments.
%C Suppose that n has baseb digits b(m), b(m1), ..., b(0). The baseb downvariation of n is the sum DV(n,b) of all d(i)d(i1) for which d(i) > d(i1); the baseb upvariation of n is the sum UV(n,b) of all d(k1)d(k) for which d(k) < d(k1). The total baseb 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="/A297249/b297249.txt">Table of n, a(n) for n = 1..10000</a>
%e 147 in base3: 1,3,1,1,0, having DV = 3, UV = 2, so that 147 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. A297250, A297251, A297330.
%K nonn,base,easy
%O 1,1
%A _Clark Kimberling_, Jan 15 2018
