A194899 Triangular array (and fractal sequence): row n is the permutation of (1,2,...,n) obtained from the increasing ordering of fractional parts {r}, {2r}, ..., {nr}, where r=sqrt(12).
1, 1, 2, 3, 1, 2, 3, 1, 4, 2, 5, 3, 1, 4, 2, 5, 3, 1, 6, 4, 2, 7, 5, 3, 1, 6, 4, 2, 7, 5, 3, 1, 8, 6, 4, 2, 9, 7, 5, 3, 1, 8, 6, 4, 2, 9, 7, 5, 3, 1, 10, 8, 6, 4, 2, 11, 9, 7, 5, 3, 1, 10, 8, 6, 4, 2, 11, 9, 7, 5, 3, 1, 12, 10, 8, 6, 4, 2, 13, 11, 9, 7, 5, 3, 1, 12, 10, 8, 6, 4, 2
Offset: 1
Examples
First nine rows: 1 1 2 3 1 2 3 1 4 2 5 3 1 4 2 5 3 1 6 4 2 7 5 3 1 6 4 2 7 5 3 1 8 6 4 2 9 7 5 3 1 8 6 4 2
Programs
-
Mathematica
r = Sqrt[12]; t[n_] := Table[FractionalPart[k*r], {k, 1, n}]; f = Flatten[Table[Flatten[(Position[t[n], #1] &) /@ Sort[t[n], Less]], {n, 1, 20}]] (* A194899 *) TableForm[Table[Flatten[(Position[t[n], #1] &) /@ Sort[t[n], Less]], {n, 1, 15}]] row[n_] := Position[f, n]; u = TableForm[Table[row[n], {n, 1, 20}]] g[n_, k_] := Part[row[n], k]; p = Flatten[Table[g[k, n - k + 1], {n, 1, 15}, {k, 1, n}]] (* A194900 *) q[n_] := Position[p, n]; Flatten[Table[q[n], {n, 1, 90}]] (* A194901 *)
-
PARI
row(n) = Vec(vecsort(vector(n, k, frac(k*sqrt(12))),,1)); tabl(nn) = for (n=1, nn, print(row(n))); \\ Michel Marcus, Feb 06 2019
Comments