%I #4 May 26 2018 22:46:19
%S 5,11,14,17,29,32,35,38,41,44,47,50,53,83,86,89,92,95,98,101,104,107,
%T 110,113,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,
%U 161,245,248,251,254,257,260,263,266,269,272,275,278,281,284,287,290
%N Numbers whose base-3 digits have greater up-variation than 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="/A297251/b297251.txt">Table of n, a(n) for n = 1..10000</a>
%e 290 in base-3: 1,0,1,2,0,2, having DV = 3, UV = 4, 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. A297249, A297250, A297330.
%K nonn,base,easy
%O 1,1
%A _Clark Kimberling_, Apr 10 2018
|