login
Array T(n,k) (k >= 1, n >= k) read by antidiagonals (see definition in Comments lines).
8

%I #17 Sep 01 2024 20:01:30

%S 1,1,2,1,2,2,1,4,2,2,1,4,4,2,2,1,3,6,4,2,2,1,3,6,7,4,2,2,1,6,4,3,7,4,

%T 2,2,1,6,4,3,15,14,4,2,2,1,10,4,8,5,6,14,4,2,2,1,10,21,10,5,10,6,14,4,

%U 2,2,1,12,3,6,12,12,12,6,14,4,2,2

%N Array T(n,k) (k >= 1, n >= k) read by antidiagonals (see definition in Comments lines).

%C T(n,k) is the order of the permutation p of [1,...,n] defined as follows:

%C Write F={1,2,3,....,n}.

%C Place F into a "window" of width k, where k <= n. That is, write out the elements from left to right, up to down, with k elements per line.

%C Produce a new set F' by traversing the set according to the following algorithm, adding elements to F' as they are traversed in F.

%C Traversal algorithm:

%C 1) Start at the upper right hand element.

%C 2) If there is an element below the current one

%C then

%C A) go to it

%C B) go back to step 2

%C 3) Otherwise, if there is a column to the left of the current one, then

%C A) go to it

%C B) go back to step 2

%C 4) End

%C Then p is the permutation that sends F to F'.

%H Robert Price, <a href="/A105272/b105272.txt">Table of n, a(n) for n = 1..1275</a>

%H Samuel Minter, <a href="http://www.abulsme.com/function.html">Abulsme function information and definition</a>

%e To find T(12,5):

%e Start with F = { A B C D E F G H I J K L } with a window of widhth 5:

%e A B C D E

%e F G H I J

%e K L

%e Now let's traverse that and construct our new set

%e Upper right is E so add it to our new set:

%e { E ....

%e We can go down so we do so and get J

%e { E J .....

%e Now we can't go down so go to the top of the column to the left and get D

%e { E J D .....

%e Eventually we will get:

%e F' = { E J D I C H B G L A F K }

%e The permutation p that sends F to F' is a single cycle of length 12, so T(12,5) = 12.

%e Array begins:

%e k = 1: 1,1,1,1,1,1,1,1,1,1,... (A000012)

%e k = 2: 2,2,4,4,3,3,6,6,10,10,... (A024222)

%e k = 3: 2,2,4,6,6,4,4,4,21,3,... (A118960)

%e k = 4: 2,2,4,7,3,3,8,10,6,6,... (A120280)

%e k = 5: 2,2,4,7,15,5,5,12,40,45,... (A120363)

%e k = 6: 2,2,4,14,6,10,12,12,7,15,... (A120654)

%e k = 7: 2,2,4,14,6,12,30,4,4,20,... (A121514)

%e k = 8: 2,2,4,14,6,13,13,24,8,8,...

%e k = 9: 2,2,4,14,6,13,15,15,63,9,...

%e k = 10: 2,2,4,14,6,13,16,10,18,12,...

%e ... (Rows converge to A121526)

%t T[1] = ConstantArray[1, 75];

%t For[k = 2, k <= 20, k++,

%t T[k] = Table[f = Range[n]; fp = {};

%t For[col = k, col > 0, col--,

%t For[row = 0, col + row*k <= n, row++,

%t AppendTo[fp, f[[col + row*k]]]]];

%t LCM @@ Length /@ First[FindPermutation[f, fp]], {n, k, 75}]];

%t A105272 = {};

%t For[i = 1, i <= 20, i++,

%t For[j = i, j >= 1, j--,

%t AppendTo[A105272, T[i - j + 1][[j]]]]];

%t A105272 (* _Robert Price_, Aug 26 2019 *)

%o (C)

%o int abulsme(int l, int s)

%o {

%o long int t[30000], m[30000], c[30000], b[30000];

%o long int k, i, n, j, z, u, q, g;

%o for (t[1] = s, k = 2; k <= l; k++)

%o {

%o m[k] = (t[k - 1] + s - l + abs(t[k - 1] + s - l)) / (2 * abs(t[k - 1] + s - l - 1) + 2);

%o t[k] = ((t[k - 1] - m[k]) % (s * m[k] + 2 * l * abs(m[k] - 1))) + s * abs(m[k] - 1);

%o }

%o for (i = 1; i <= l; b[i] = 0, i++)

%o ;

%o for (n = 0, i = 1; i <= l; i++)

%o {

%o if (!b[i])

%o {

%o j = i;

%o k = 0;

%o do

%o {

%o j = t[j];

%o b[j] = 1;

%o k++;

%o } while (j != i);

%o u = 1;

%o z = 1;

%o if (i > 1)

%o {

%o do

%o {

%o if (c[z] == k)

%o {

%o u = 0;

%o }

%o z++;

%o } while (!((z > n) || (!u)));

%o }

%o if (u)

%o {

%o n++;

%o c[n] = k;

%o }

%o }

%o for (q = c[1], g = q, z = 1; z < n; z++, g = q)

%o {

%o for (0; q % c[z + 1]; q += g)

%o ;

%o }

%o }

%o return g;

%o }

%K nonn,tabl

%O 1,3

%A _N. J. A. Sloane_, Aug 10 2008, based on email from Samuel Minter (abulsme(AT)abulsme.com), May 08 2008

%E a(46)-a(78) from _Robert Price_, Aug 26 2019