📜 ⬆️ ⬇️

On a combinatorial problem

In the process of scientific work, I have accumulated several interesting results, which, from my point of view, are rather weak for publication in a scientific publication, but in themselves are of interest, for example, in the field of sports programming. One of these results, which I will formulate below, in some variation can be offered to an applicant for an interview at a large IT company.


So, I'll start from afar. I studied stationary localized structures in the one-dimensional Gross – Pitaevskii equation, [work example] . Such structures, under certain sufficient conditions on the parameters of the problem, can be encoded with infinite in both directions, symbolic sequences, which we call codes. That is, continuous solutions of a differential equation are classified by discrete codes. The encoding alphabet is usually finite and consists of some odd number of characters, for example, from N = 2L + 1 characters where L - natural number. The alphabet has a null character , and all other symbols are divided into pairs connected by some symmetry. For simplicity, we will denote the alphabet encoding A = \ {i \} _ {i = -L} ^ L where symbols i and -i symmetrical to each other. Number N we will call the power of the alphabet A .


Since the structures studied by us are localized in space, their codes begin and end with an infinite number of zero symbols, that is, they have the form


{\ bf c} = (\ ldots, 0, s_1, s_2, \ ldots, s_M, 0, \ ldots), \ quad s_i \ in A, \ quad s_1 \ neq 0, \ quad s_M \ neq 0.


Central part of the code {\ bf c} , or its carrier, consists of M characters, with the extreme characters of the carrier, s_1 and s_M , are not null characters. Number M we will call the code length {\ bf c} . Now, for each code {\ bf c} we can write three symmetric codes,


\ mathcal {I} _1 {\ bf c} = (\ ldots, 0, s_M, s_ {M-1}, \ ldots, s_1,0, \ ldots), \\ \ mathcal {I} _2 {\ bf c } = (\ ldots, 0, -s_1, -s_2, \ ldots, -s_M, 0, \ ldots), \\ \ mathcal {I} _1 \ mathcal {I} _2 {\ bf c} = (\ ldots, 0, -s_M, -s_ {M-1}, \ ldots, -s_1,0, \ ldots),


Where \ mathcal {I} _1 and \ mathcal {I} _2 - two codes of symmetry of interest. The task is set as follows: find the number of all codes of length M composed of a power alphabet N accurate to two symmetries \ mathcal {I} _1 and \ mathcal {I} _2 . That is, if two arbitrary codes are connected by symmetries \ mathcal {I} _1 , \ mathcal {I} _2 or \ mathcal {I} _1 \ mathcal {I} _2 then we consider such codes to be the same. In terms of time trouble, at the interview, you can quickly answer that the number of all codes without symmetries is equal to (N-1) ^ 2N ^ {M-2} . Further, from my point of view, the task should be solved with a pencil in hand. At once I will say that my solution may not be optimal (in the sense of the number and simplicity of mathematical operations). User mihaild offered a very elegant solution to this problem through the group of invariant permutations and the Burnside Lemma.


Decision

Denote the set of all codes D_0 . Break up D_0 into three disjoint subsets


D_1 = \ {{\ bf c} \ mid {\ bf c} = \ mathcal {I} _1 {\ bf c} \}, \\ D_2 = \ {{\ bf c} \ mid {\ bf c} = \ mathcal {I} _1 \ mathcal {I} _2 {\ bf c} \}, \\ D_3 = \ {{\ bf c} \ mid {\ bf c} \ neq \ mathcal {I} _1 {\ bf c }, \ {\ bf c} \ neq \ mathcal {I} _1 \ mathcal {I} _2 {\ bf c} \}.


In a subset D_1 codes have the following structure


{\ bf c} = (\ ldots, 0, s_1, s_2, \ ldots, s _ {\ frac {M-1} {2}}, s _ {\ frac {M + 1} {2}}, s _ {\ frac {M-1} {2}}, \ ldots, s_2, s_1,0, \ ldots), \ quad M - \ mbox {odd}, \\ {\ bf c} = (\ ldots, 0, s_1, s_2, \ ldots, s _ {\ frac {M} {2}}, s _ {\ frac {M} {2}}, \ ldots, s_2, s_1,0, \ ldots), \ quad M - \ mbox {even }.


In a subset D_2 codes have the following structure


{\ bf c} = (\ ldots, 0, s_1, s_2, \ ldots, s _ {\ frac {M-1} {2}}, s _ {\ frac {M + 1} {2}}, - s_ { \ frac {M-1} {2}}, \ ldots, -s_2, -s_1,0, \ ldots), \ quad M - \ mbox {odd}, \\ {\ bf c} = (\ ldots, 0 , s_1, s_2, \ ldots, s _ {\ frac {M} {2}}, - s _ ​​{\ frac {M} {2}}, \ ldots, -s_2, -s_1,0, \ ldots), \ quad M - \ mbox {even}.


Accordingly, by definition, in subsets D_1 and D_2 codes are divided into pairs ({\ bf c}, \ mathcal {I} _2 {\ bf c}) , and in a subset D_3 - on four ({\ bf c}, \ mathcal {I} _1 {\ bf c}, \ mathcal {I} _2 {\ bf c}, \ mathcal {I} _1 \ mathcal {I} _2 {\ bf c}) , i.e


Q (D_1) = \ frac {| D_1 |} {2}, \ quad Q (D_2) = \ frac {| D_2 |} {2}, \ quad Q (D_3) = \ frac {| D_3 |} {4 } = \ frac {| D_0 | - | D_1 | - | D_2 |} {4},


Where Q (D) - the number of different codes in a subset D , | D | - power D . Consider the case of the odd M . For subsets D_1 , D_2 and D_3 write down


Q (D_1) = \ frac {N-1} {2} N ^ \ frac {M-1} {2}, \\ Q (D_2) = \ frac {N-1} {2} N ^ \ frac { M-3} {2}, \\ Q (D_3) = \ frac {(N-1) ^ 2} {4} N ^ {M-2} - \ frac {N-1} {4} N ^ \ frac {M-1} {2} - \ frac {N-1} {4} N ^ \ frac {M-3} {2}.


For the original set D_0 get an estimate


Q (D_0) = \ sum_ {i = 1} ^ 3 {Q (D_i)} = \ frac {N-1} {4} \ left [N ^ {M-1} \ left (1- \ frac {1 } {N} \ right) + \ sqrt {N ^ {M-1}} \ left (1+ \ frac {1} {N} \ right) \ right].


Consider the case of even M . For subsets D_1 , D_2 and D_3 write down


Q (D_1) = \ frac {N-1} {2} N ^ {\ frac {M} {2} -1}, \\ Q (D_2) = \ frac {N-1} {2} N ^ { \ frac {M} {2} -1}, \\ Q (D_3) = \ frac {(N-1) ^ 2} {4} N ^ {M-2} - \ frac {N-1} {2 } N ^ {\ frac {M} {2} -1}.


For the original set D_0 get an estimate


Q (D_0) = \ sum_ {i = 1} ^ 3 {Q (D_i)} = \ frac {N-1} {4} \ left [N ^ {M-1} \ left (1- \ frac {1 } {N} \ right) + \ frac {2 \ sqrt {N ^ M}} {N} \ right].


Answer

As a result, as a response, we can write the following system of equations (we replace the notation Q (D_0) on Q (N, M) , because Q depends on variables N and M )


Q (N, M) = \ left \ {\ begin {array} {l} \ frac {N-1} {4} \ left [N ^ {M-1} \ left (1- \ frac {1} { N} \ right) + \ sqrt {N ^ {M-1}} \ left (1+ \ frac {1} {N} \ right) \ right], \ quad M - \ mbox {odd}, \\ \ frac {N-1} {4} \ left [N ^ {M-1} \ left (1- \ frac {1} {N} \ right) + \ frac {2 \ sqrt {N ^ M}} {N } \ right], \ quad M - \ mbox {even}. \ end {array} \ right.


In conclusion, I note that the answer was a bit more complicated than it seemed at the first acquaintance with the task. Such a task is hardly suitable for a blitz survey, but it is also not too difficult, in order not to be offered at an interview in any variation. To check the resulting formula, we give the following values: Q (3,1) = 1 , Q (3,2) = 2 , Q (3.3) = 5 , Q (3.4) = 12 . Accordingly, we present a table of various codes that occurs in this case. Because N = 3 then we will write down the codes made up of the simplified alphabet A = \ {+, 0, - \} .


\ begin {center} \ begin {small} \ begin {tabular} {| l | l | l | l | l |} \ hline $ M = 1 $ & amp; $ M = 2 $ & amp; $ M = 3 $ & amp; $ M = 4 $ \\ hline \ g {$ (\ ldots, 0, +, 0, \ ldots) $} & amp; \ g {$ (\ ldots, 0, +, +, 0, \ ldots) $} & amp; \ g {$ (\ ldots, 0, +, +, +, 0, \ ldots) $} & amp; \ g {$ (\ ldots, 0, +, +, +, +, 0, \ ldots) $} \\ & amp; \ y {$ (\ ldots, 0, +, -, 0, \ ldots) $} & amp; \ y {$ (\ ldots, 0, +, +, -, 0, \ ldots) $} & amp; \ y {$ (\ ldots, 0, +, +, -, +, 0, \ ldots) $} \\ & amp; & amp; \ y {$ (\ ldots, 0, +, -, +, 0, \ ldots) $} & amp; \ y {$ (\ ldots, 0, +, -, -, +, 0, \ ldots) $} \\ & amp; & amp; \ y {$ (\ ldots, 0, +, 0, +, 0, \ ldots) $} & amp; \ y {$ (\ ldots, 0, +, +, 0, +, 0, \ ldots) $} \\ & amp; & amp; \ g {$ (\ ldots, 0, +, 0, -, 0, \ ldots) $} & amp; \ y {$ (\ ldots, 0, +, -, 0, +, 0, \ ldots) $} \\ & amp; & amp; & amp; \ g {$ (\ ldots, 0, +, 0,0, +, 0, \ ldots) $} \\ & amp; & amp; & amp; \ y {$ (\ ldots, 0, +, +, +, -, 0, \ ldots) $} \\ & amp; & amp; & amp; \ y {$ (\ ldots, 0, +, +, -, -, 0, \ ldots) $} \\ & amp; & amp; & amp; \ y {$ (\ ldots, 0, +, -, +, -, 0, \ ldots) $} \\ & amp; & amp; & amp; \ g {$ (\ ldots, 0, +, +, 0, -, 0, \ ldots) $} \\ & amp; & amp; & amp; \ y {$ (\ ldots, 0, +, -, 0, -, 0, \ ldots) $} \\ & amp; & amp; & amp; \ y {$ (\ ldots, 0, +, 0,0, -, 0, \ ldots) $} \\ \ hline \ end {tabular} \ end {small} \ end {center}


')

Source: https://habr.com/ru/post/318458/


All Articles