Skip to main content
OlympiadHQ

Browse · MathNet

Print

Rioplatense Mathematical Olympiad

Argentina number theory

Problem

Magalí's calculator has a special button ⋆ that works as follows. Every time she presses ⋆, the calculator multiplies the number on the screen by itself, then adds 6, and finally shows the result on the screen. For example, if the number on the screen is and Magalí presses ⋆, the number that will appear on the screen is . Magalí chooses a prime number, writes it on the calculator, and presses the ⋆ button many times. The ⋆ button gets blocked when a number that is not prime appears on the screen. What is the greatest number of times that she can press the ⋆ button?
Solution
The answer is 3. First, notice that the last digit of Magalí's initial number, name it , determines the last digit of the following numbers. This is explained in the following table, where we name , , and :
175blocked ⋆blocked ⋆
20blocked ⋆blocked ⋆blocked ⋆
35blocked ⋆blocked ⋆blocked ⋆
5175blocked ⋆
75blocked ⋆blocked ⋆blocked ⋆
975blocked ⋆blocked ⋆
For example, if had 4 as its last digit, then would have the same last digit as , which is 2. We omitted the numbers with their last digit being even but different from 2 because they cannot be prime. Now, observe on the table that no matter which prime number Magalí chooses initially, in at most three steps she reaches a number with last digit 0 or 5, and so a multiple of 5. Since this number is greater than 5, it is not a prime number. Therefore, she can never press the ⋆ button more than three times. It is possible that Magalí presses ⋆ three times. Indeed, if she starts with , the following numbers are , and . Since 5, 31 and 967 are prime numbers and is a multiple of 5, this proves the desired result.
Final answer
3

Techniques

Polynomials mod pPrime numbers