Maths Olympiad Prep

Library / /255 of 299

Combinatorics Difficulty 7.3 National Olympiad, round 2 Prove it Iran

In this question, functions on natural numbers that are computable by a computer (which has a finite memory and output) for arbitrary large numbers are investigated. These functions are called Computable Functions. Since a computer has a finite number of outputs, the investigation is restricted only to those functions that have a finite range (which is equivalent to all possible finite outputs of a computer). Next, the method by which a number is given to a computer needs to be clarified. A common way is using the representation of numbers in a fixed base kk.

By determining the inputs and outputs of a computer, a mathematical model can be derived to describe (i.e. to model) its operation. The main idea here is that a computer has a finite number of states (considering the states of all inner components) and it changes after receiving each input digit according to a predefined program. Consequently, the output is a function of the computer's state. Using these concepts a precise definition of a kk-Computable sequence can be given.

First, a Machine needs to be defined. A Machine with input set AA and output set BB (sets AA and BB are finite) comprises a finite number of states and an algorithm that determines the state of the Machine after an input (which is an arbitrary member of AA) is entered. Also, each state of the Machine determines a member of BB as the output. Moreover, a specific state, called the Starting State, is used to start the Machine. A Machine of this kind can determine a member of BB as the output for a finite sequence of entries from AA. This can be done by setting the Machine to its Starting State and then entering the inputs from the sequence one by one. The output of the final state is considered as the computed value.

Let kk be a natural number greater than 1. A sequence a1,a2,a3,a_1, a_2, a_3, \dots with values in the finite set BB is called kk-Computable if there exists a Machine with input set {0,1,,k1}\{0, 1, \dots, k-1\} and output set BB such that when digits of an arbitrary number nn in base kk are entered to the Machine from right to left, respectively, the Machine's output is ana_n.

As an example, consider the following Machine for k=2k=2 (circles represent states and the output of each state is written on it. This Machine receives 0 and 1 as inputs).
Figure 1
Using this Machine the sequence a,b,a,a,a,b,a,b,a, b, a, a, a, b, a, b, \dots can be computed. For example, for n=10=(1010)2n = 10 = (1010)_2, 0, 1, 0 and 1 should be given to the Machine starting from its Starting State. If this is done, the lower left state is reached which gives aa as the output. According to the definition, the sequence a,b,a,a,a,b,a,b,a, b, a, a, a, b, a, b, \dots is 2-Computable.

a) Suppose mm is a natural number. For each natural number nn, define (an)(a_n) as the remainder of nn when divided by mm (so values of this sequence are all in the finite set {0,1,,m1}\{0, 1, \dots, m-1\}). Prove that for each natural number kk, this sequence is kk-Computable.

b) Prove that if sequence (an)(a_n) is kk-Computable, so are sequences (bn)(b_n) and (cn)(c_n) that are defined as bn=an+1b_n = a_{n+1} and cn=a2nc_n = a_{2n}.

c) Define sequence (an)(a_n) to be 1 for perfect square natural numbers and 0 for the rest. Is this sequence 3-Computable?

d) The definition of Computable sequences can be altered by assuming that the digits are given to the Machine from left to right. These sequences are called kk-Left Computable. Prove that this definition is equivalent to the previous one, i.e. a sequence is kk-Computable if and only if it is kk-Left Computable.

Solution

a) The idea here is that a computer (with sufficiently large but finite memory) can compute the remainder of arbitrary large natural numbers when divided by mm. The following describes a Machine for computing the remainder of a given number modulo mm in base kk:

* Inputs: Set {0,1,,k1}\{0, 1, \dots, k-1\}.
* States: A state exists for each pair (i,j)(i, j) of {0,1,,m1}\{0, 1, \dots, m-1\}.
* Outputs: The output of state (i,j)(i, j) is jj.
* Starting State: (1,0)(1, 0).
* Transition Function: When rr is entered, the state of the Machine changes from (i,j)(i, j) to (i,j)(i', j'), where ii' and jj' are the remainders of kiki and j+rij + ri when divided by mm, respectively.

b) Let XX be the Machine that computes (an)(a_n) in base kk. To introduce a Machine that computes (bn)(b_n), where bn=an+1b_n = a_{n+1}, in base kk, first a Machine is designed that takes an rr-digit number nn as input and gives (a,b)(a, b) as output, where aa and bb are the rthr^{th} and (r+1)th(r+1)^{th} digits of n+1n+1 in base kk (from right). Note that n+1n+1 has at most r+1r+1 digits, and if it has only rr digits, then bb will be zero. The following Machine will perform this operation:

* Inputs: Set {0,1,,k1}\{0, 1, \dots, k-1\}.
* States: A state exists for each pair (a,b)(a, b) of integers, where 0a<k0 \le a < k and b{0,1}b \in \{0, 1\}.
* Outputs: The output of state (a,b)(a, b) is (a,b)(a, b) itself.
* Starting State: (1,0)(1, 0).
* Transition Function: When rr is entered, the state of the Machine changes from (a,b)(a, b) to (a,b)(a', b'), where aa' is the remainder of r+br + b when divided by mm, and bb' is 0 for r+b<kr + b < k and 1 elsewhere.

Call this Machine BB. Now, make Machine YY from BB and XX to compute (bn)(b_n). Denote the set of states and the Starting State of XX by SXS_X and SBS_B, respectively. SXS_X and SBS_B are defined similarly. The following Machine will perform the desired operation:

* Inputs: Set {0,1,,k1}\{0, 1, \dots, k-1\}.
* States: SX×SBS_X \times S_B.
* Outputs: The output of state (x,y)(x, y), where xSXx \in S_X and ySBy \in S_B, is defined as follows: Let (a,b)(a, b) be the output of state yy in BB. Now, if b=0b = 0, define the output of (x,y)(x, y) (in YY) to be equal to the output of xx (in XX); and if b0b \neq 0, define it to be the output of XX after entering bb when XX is in state xx.
* Starting State: (sX,sB)(s_X, s_B).
* Transition Function: When rr is entered, the state of the Machine changes from (x,y)(x, y) to (x,y)(x', y'), where yy' is the state of BB after entering rr when it is in state yy. Now, if (a,b)(a, b) is the output of yy', xx' will be the state of XX after entering aa when it is in state xx.

To compute cn=a2nc_n = a_{2n}, first define a Machine CC similar to BB for the purpose of multiplication by 2. Then use CC instead of BB in the definition of YY above to get the desired result. The Machine CC is described as follows:

* Inputs: Set {0,1,,k1}\{0, 1, \dots, k-1\}.
* States: A state exists for each pair (a,b)(a, b) of integers, where 0a<k0 \le a < k and b{0,1}b \in \{0, 1\}.
* Outputs: The output of state (a,b)(a, b) is (a,b)(a, b) itself.
* Starting State: (0,0)(0, 0).
* Transition Function: When rr is entered, the state of the Machine changes from (a,b)(a, b) to (a,b)(a', b'), where aa' and bb' are the quotient and remainder of 2r+b2r + b when divided by kk, respectively.

c) No! Assume to the contrary that XX is a Machine that computes (an)(a_n) in base 3. Let NN be the number of states of XX. Note that for a sufficiently large natural number mm, the number of mm-digit perfect square numbers in base 3 is more than NN. So there are two perfect squares aa and bb such that after entering digits of these two numbers to XX (from right) the same state is reached. Therefore, entering numbers of the form a+3mna + 3^m n and b+3mnb + 3^m n results in the same output. Hence if (an)(a_n) is 3-Computable, then for each natural number nn, a+3mna + 3^m n is a perfect square if and only if b+3mnb + 3^m n is a perfect square. But this is impossible, because the difference of these numbers is bab - a (which is constant), whereas the difference of consecutive perfect square numbers approaches infinity.

d) Suppose that XX is a Machine with inputs from the set {0,1,,k1}\{0, 1, \dots, k-1\}. It will be shown that each kk-Computable sequence is kk-Left Computable, the converse can be proved similarly. To do this, it suffices to introduce a Machine YY with the same input set as XX such that the output of YY after entering digits of a number from left to right equals to the output of XX after entering digits of that same number from right to left. Suppose that {s1,s2,,sm}\{s_1, s_2, \dots, s_m\} is the state set of XX, s1s_1 its Starting State and xix_i the output of state sis_i. The following Machine will perform the desired operation:

* Inputs: Set {0,1,,k1}\{0, 1, \dots, k-1\}.
* States: All mm-tuples (A1,A2,,Am)(A_1, A_2, \dots, A_m) of partitions of the set {s1,s2,,sm}\{s_1, s_2, \dots, s_m\}.
* Outputs: The output of state (A1,A2,,Am)(A_1, A_2, \dots, A_m) will be AiA_i, where s1Ais_1 \in A_i.
* Starting State: ({s1},{s2},,{sm})(\{s_1\}, \{s_2\}, \dots, \{s_m\}).
* Transition Function: When rr is entered, the state of the Machine changes from (A1,A2,,Am)(A_1, A_2, \dots, A_m) to (B1,B2,,Bm)(B_1, B_2, \dots, B_m), where BiB_i is the set of all those states of XX that change to a state in AiA_i after entering rr in XX.

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.