%I #7 Jan 14 2018 18:23:27
%S 5,15,16,46,47,48,50,138,140,141,142,145,146,150,151,415,416,420,421,
%T 424,425,426,428,435,437,438,439,451,452,453,455,1245,1247,1248,1249,
%U 1261,1262,1263,1265,1272,1274,1275,1276,1279,1280,1284,1285,1306,1307
%N Numbers having an up-first zigzag pattern in base 3; see Comments.
%C A number n having base-b digits d(m), d(m-1), ..., d(0) such that d(i) != d(i+1) for 0 <= i < m shows a zigzag pattern of one or more segments, in the following sense. Writing U for up and D for down, there are two kinds of patterns: U, UD, UDU, UDUD, ... and D, DU, DUD, DUDU, ... . In the former case, we say n has an "up-first zigzag pattern in base b"; in the latter, a "down-first zigzag pattern in base b". Example: 2,4,5,3,0,1,4,2 has segments 2,4,5; 5,3,0; 0,1,4; and 4,2, so that 24530142, with pattern UDUD, has an up-first zigzag pattern in base 10, whereas 4,2,5,3,0,1,4,2 has a down-first pattern. The sequences A297124..A297127 partition the natural numbers. See the guide at A297146.
%e Base-3 digits of 1307: 1,2,1,0,1,0,1, with pattern UDUDU, so that 1307 is in the sequence.
%t a[n_, b_] := Sign[Differences[IntegerDigits[n, b]]]; z = 300;
%t b = 3; t = Table[a[n, b], {n, 1, 10*z}];
%t u = Select[Range[z], ! MemberQ[t[[#]], 0] && First[t[[#]]] == 1 &] (* A297124 *)
%t v = Select[Range[z], ! MemberQ[t[[#]], 0] && First[t[[#]]] == -1 &] (* A297125 *)
%t Complement[Range[z], Union[u, v]] (* A297126 *)
%Y Cf. A297125, A297126.
%K nonn,easy,base
%O 1,1
%A _Clark Kimberling_, Jan 13 2018
|