Find all positive integers n such that every positive integer with n digits, one of which is 7 and the others 1, is prime.
Solution
Answer: n = 1, 2.
Solution by Demetres Christofides
For n = 1, we note that 7 is prime. For n = 2, we note that 17 and 71 are prime. So the result is true for n = 1, 2.
Note that 111111 = 111.1001 is divisible by 7 and 13. Now 7111 is divisible by 13, so 7111, 7111111111, 7111111111111111, ... are all divisible by 13. In other words the result is not true for n = 4 mod 6. Similarly, since 7 divides 11711 it is not true for n = 5 mod 6. Also since 7 divides 7, it also divides 7111111 etc, so the result is not true for n = 1 mod 6 and n > 1. Also 611 is divisible by 13 and hence 11111711 is divisible by 13, so the result is not true for n = 2 mod 6 and n > 2. Finally, if n = 0 or 3 mod 6, then any number with n digits all 1 or 7, is divisible by 3 and hence not prime.
© John Scholes
jscholes@kalva.demon.co.uk
21 Nov 2002