A363996 Rectangular array by descending antidiagonals: row n consists of the numbers k such that n = 1 + maximal runlength of 1's in the ternary representation of k.
2, 6, 1, 8, 3, 4, 18, 5, 12, 13, 20, 7, 14, 39, 40, 24, 9, 22, 41, 120, 121, 26, 10, 31, 67, 122, 363, 364, 54, 11, 36, 94, 202, 365, 1092, 1093, 56, 15, 37, 117, 283, 607, 1094, 3279, 3280, 60, 16, 38, 118, 360, 850, 1822, 3281, 9840, 9841, 62, 17, 42, 119
Offset: 1
Examples
Corner: 2 6 8 18 20 24 26 1 3 5 7 9 10 11 4 12 14 22 31 36 37 13 39 41 67 94 117 118 40 120 122 202 283 360 361 121 363 365 607 850 1089 1090 Let r(n) = maximal runlength of 1's in the ternary representation of n, for n >= 1, so that (r(n)) = (1,0,1,2,1,0,1,0,1,...). Thus, r(4)=2, so the first term in row 3 of the array is 4.
Programs
-
Mathematica
d[n_] := d[n] = First[RealDigits[n, 3]]; f[w_] := FromDigits[w, 3]; s = Map[Split, Table[d[n], {n, 1, 50000}]]; x[n_] := Select[s, MemberQ[#, Table[1, n]] &]; u[n_] := Map[Flatten, x[n]]; t0 = Select[Range[1, 4000], DigitCount[#, 3, 1] == 0 &, 20]; v = Table[Take[Map[f, u[n]], Min[{20, Length[u[n]]}]], {n, 1, 11}] t = Join[{t0}, v] TableForm[t] (* this sequence as an array *) Table[t[[n - k + 1, k]], {n, 11}, {k, n, 1, -1}] // Flatten (* this sequence *)
Comments