Find all natural numbers $ n$ for which every natural number whose decimal representation has $ n - 1$ digits $ 1$ and one digit $ 7$ is prime.
Problem
Source: IMO ShortList 1990, Problem 27 (USS 1)
Tags: number theory, decimal representation, prime numbers, Digits, IMO Shortlist
16.08.2008 23:34
28.01.2010 16:45
tjhance wrote: As $ k$ goes from $ 0$ to $ 6$, the term $ 6\cdot 10^k$ takes on all values $ \mod 7$, so at least one of the numbers $ x + 6\cdot 10^k$ must be divisible by $ 7$. Hence no $ n\ge 7$ can work, so the only values of $ n$ are $ n = 1$ and $ n = 2$. $ 6\cdot 10^k$ never takes on the value $ 0$, so none of the numbers $ x + 6\cdot 10^k$ is necessarily divisible by 7. Take, for instance, $ x = 111111111111$ or as in the example you gave for $ n = 6$ , which are 0 mod 7. Each of the permutations of the digits $ 111111111117$ is not divisible by 7. The same is true for any other number of $ n$ digits 1, as long as $ n = 6q + 6$. But in those cases, we have a number of $ 6q + 5$ digits 1 and one $ 7$, which are always divisible by $ 3$.
29.01.2010 01:36
Oh, thanks, I didn't notice that.
21.04.2011 07:07
31.08.2024 22:30
Solved with OronSH and plang2008. The answer is $n = 1$ and $n = 2$, which clearly work as $7, 17, 71$ are all prime. Now we assume that $n > 2$. Firstly, if $3 \mid n$, then any such number will have sum of digits $n-1 + 7 = n + 6$, which is a multiple of $3$. Since it is not equal to $3$, it can't be prime, absurd. Hence $3\nmid n$. If $n = 4$, then we have a contradiction as $187$ divides $7111$. If $n = 5$, then we have a contradiction as $239$ divides $11711$. Henceforth assume $n > 6$. The number with all ones and $n$ digits is $\frac{10^n - 1}{9}$. Now, natural numbers with $n-1$ ones and one $7$ are $\frac{10^n - 1}{9} + 6 \cdot 10^k$ for some integer $0 \le k \le n-1$. Note that $10 \equiv 3 \pmod 7$ is a primitive root modulo $7$, so $10^k$ is surjective modulo $7$ for $n \ge 7$, meaning $6 \cdot 10^k$ is also surjective modulo $7$. Hence setting $k$ where $7$ divides $\frac{10^n - 1}{9} + 6 \cdot 10^k$ gives a contradiction (as this number is clearly over $7$).