login
Array G(M,S), where M are the permutations of the first K integers and S is the size of a list of distinct items, (k = 1, 2, ..., S >= k) to be read by antidiagonals (see definition in Comments).
1

%I #34 Sep 25 2023 07:37:21

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

%T 3,3,1,6,6,2,6,4,4,4,2,1,6,6,2,6,6,6,4,2,1,1,10,10,6,4,4,6,6,4,4,2,1,

%U 10,10,5,4,4,4,2,6,6,3,2,1,12

%N Array G(M,S), where M are the permutations of the first K integers and S is the size of a list of distinct items, (k = 1, 2, ..., S >= k) to be read by antidiagonals (see definition in Comments).

%C G(M,S) is defined as follows:

%C 1. Given:

%C * M, a permutation of the K integers 0..k-1 called M, where K >= 1.

%C * S, the number of distinct, ordered integers, where S >= K.

%C 2. Form S' as the array of integers 0..S-1 inclusive. This is the initial ordering S0'.

%C 3. Form groups:

%C * Form group group[0] by concatenating every K-th item of S' starting from index 0

%C * Form group group[1] by concatenating every K-th item of S' starting from index 1

%C ...

%C * Form group group[K-1] by concatenating every K-th item of S' starting from index K-1

%C 4. Concatenate groups:

%C * Concatenate all the groups[] in the order given by M to form the first partial result P(1)

%C P(1) = concatenate_left_to_right(group[i] for i in M)

%C 5. Repetition:

%C * Substituting P for S', repeat the above process from 3, until the order of items in P equals the initial order S0'.

%C 6. Result:

%C * G(M, S) = the number of repetitions needed of steps 3 through 5.

%C M is tabulated as the lexicographically ordered permutations of K integers counted from zero, for K = 1, 2,...

%C Array begins:

%C M = (0): 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,...

%C M = (0, 1): 1,2,2,4,4,3,3,6,6,10,10,12,12,4,4,8,8,18,18,6,...

%C M = (1, 0): 2,2,4,4,3,3,6,6,10,10,12,12,4,4,8,8,18,18,6,6,...

%C M = (0, 1, 2): 1,3,4,4,6,2,2,6,5,5,11,6,6,15,16,16,52,4,4,38,...

%C M = (0, 2, 1): 2,2,2,4,6,6,4,4,4,21,3,3,30,4,4,90,18,18,24,5,...

%C M = (1, 0, 2): 2,2,4,4,6,4,4,4,21,21,3,30,30,8,90,90,18,24,24,10,...

%C M = (1, 2, 0): 3,3,4,6,6,4,6,6,5,11,11,6,15,15,16,52,52,4,38,38,...

%C M = (2, 0, 1): 3,4,4,6,2,2,6,5,5,11,6,6,15,16,16,52,4,4,38,11,...

%C M = (2, 1, 0): 2,2,4,6,6,4,4,4,21,3,3,30,4,4,90,18,18,24,5,5,...

%C It appears that the Abulsme function A105272 is given by A105272(n,k) == G(M,S) when M is the sorting of integers 0..K-1 from highest to lowest, and S is n.

%C (Python):

%C def A105272(n, k):

%C return A365096(range(k)[::-1], n)

%H Donald 'Paddy' McCarthy, <a href="/A365096/b365096.txt">Table of n, a(n) for n = 1..5050</a>

%H Donald S. McCarthy "Paddy3118", <a href="https://paddy3118.blogspot.com/2023/08/the-godeh-series-python-and-oeis.html">The Godeh Series, Python, and OEIS</a>

%e Given M = (0, 1) and S = 2:

%e k = 2, the number of elements of M

%e S0' = S' = [0, 1]

%e S' = P(1) = [0, 1]

%e == S0' after repetitions = 1

%e Given M = (0, 1) and S = 3:

%e k = 2, the number of elements of M

%e S0' = S' = [0, 1, 2]

%e S' = P(1) = [0, 2, 1]

%e S' = P(2) = [0, 1, 2]

%e == S0' after repetitions = 2

%e Given M = (0, 1) and S = 4:

%e k = 2, the number of elements of M

%e S0' = S' = [0, 1, 2, 3]

%e S' = P(1) = [0, 2, 1, 3]

%e S' = P(2) = [0, 1, 2, 3]

%e == S0' after repetitions = 2

%e Given M = (0, 1) and S = 5:

%e k = 2, the number of elements of M

%e S0' = S' = [0, 1, 2, 3, 4]

%e S' = P(1) = [0, 2, 4, 1, 3]

%e S' = P(2) = [0, 4, 3, 2, 1]

%e S' = P(3) = [0, 3, 1, 4, 2]

%e S' = P(4) = [0, 1, 2, 3, 4]

%e == S0' after repetitions = 4

%o (Python)

%o def G(m: list[int], s: int) -> int:

%o k = len(m)

%o assert s >= k

%o assert set(range(k)) == set(m), \

%o f"Sequence m of length {k} should contain a permutation of all the " \

%o f"numbers 0..{k-1} inclusive."

%o s_init = list(range(s))

%o n, s = 0, None

%o while s != s_init:

%o if n == 0:

%o s = s_init

%o n += 1

%o s = sum((s[offset::k] for offset in m),

%o start=[])

%o return n

%Y Cf. A000012 (row 1), A024222 (rows 2 and 3), A118960 (rows 5 and 9), A120280 (rows 15 and 33), A120363 (rows 57 and 153), A120654 (rows 273 and 873).

%Y Cf. A105272.

%K nonn,tabl

%O 1,5

%A _Donald 'Paddy' McCarthy_, Aug 21 2023