Skip to main content
OlympiadHQ

Browse · MathNet

Print

Czech-Polish-Slovak Mathematics Competition

number theory

Problem

A strange calculator has only two buttons with positive integers, each consisting of two digits. It displays the number at the beginning. Whenever a button with number is pressed, the calculator replaces the displayed number with the number or . Multiplication and addition alternate, multiplication is the first. (For example, if the number is on the 1st button, the number is on the 2nd button, and we consecutively press the 1st, 2nd, 1st, and 1st button, we get the results , , , and .) Decide whether there exist particular values of the two-digit numbers on the buttons such that one can display infinitely many numbers ending with (a) , (b) .
Solution
Let be the numbers written on the buttons. Consider the sequence such that is formed by the last four digits of for each , that is, Since there are only finitely many different possible values for and each term is only dependent on the value of the previous term, the sequence must be periodic, with the period starting in the term whose value first occurs for the second time in the sequence. In general, the period does not have to start with (e.g., if we take , , and , then all the terms except end with zero, hence the value of never occurs again). However, consider the special case when is coprime with . We claim that then the period starts with . In fact, suppose that is the first term of the sequence whose value occurs again, say , . If , the equality can be rewritten as , that is, Since is coprime with , we have , implying . But this is in contrary with the assumption was the first term whose value repeats. The previous paragraph suggests the algorithm how to display the requested number infinitely many times: We only need to produce the number once, using buttons with coprime with , and then repeat the sequence forever. In case we get the requested number with even number of presses, i.e., ending with addition, repeating the sequence will do the same desired effect. There are many ways how to display using only few presses. E.g., we can try to find such that . Since , we can take and . Indeed, we will get Notice that is coprime with . Therefore the (a) part is solved.

In the part (b), we analogously wish to generate the sequence described above with . However, it is not so easy to produce the initial occurrence of using only a few presses. Therefore, we shall instead produce , knowing that performing the sequence afterwards will eventually reach . One possible way is to find according to the schema The equation can be rewritten as . From there, we can easily deduce several 2-digit solutions, one of which is . Since is coprime with , the procedure will reach numbers ending with infinitely many times.

---

Alternative solution.

One can construct a sequence in which every 4-digit number occurs infinitely many times. Consider the calculator with and . Applying the same arguments as above, we deduce that if we keep pressing the first button (with number on it, which is coprime with ), after a finite even number of presses we obtain a number ending with again. If we change the button in the very last operation, that is, we replace with , we get a number ending with . In the same way, we can always increment the number formed by the last 4 digits by (or change to ). The conclusion follows.
Final answer
Yes for both. For example: (a) choose 31 and 34 to obtain the target and then repeat the two-step cycle; (b) choose 47 and 62 to obtain the target and then repeat. Moreover, choosing 11 and 12 allows generating all four-digit endings infinitely often.

Techniques

Inverses mod nFactorization techniquesPigeonhole principleRecurrence relations