# Find all $n$ such that each number containing $n$ $1$'s and one $3$ is prime

This question is O205 from the Mathematical Reflections. I do not own any copyrights to this question.

Find all $n$ such that each number containing $n$ $1$'s and one $3$ is prime.

For example, when $n=2$ we find that $113, 131$ and $311$ are prime.

-
Clearly $n$ is not a multiple of $3$. –  user21436 Mar 1 '12 at 11:49
There is a test for the divisibility by 7 (en.wikipedia.org/wiki/Divisibility_rule#Divisibility_by_7, second §) which rules out any $n \geq 6$. –  D. Thomine Mar 1 '12 at 11:49
@D.Thomine Could you elaborate? –  Sidharth Iyer Mar 1 '12 at 12:05
@D. Thomine That seems to rule out only those $n$ greater than $4$ which are not congruent to $5$ mod $6$. –  Chris Eagle Mar 1 '12 at 12:13
@ Chris. You are right. I found my mistake. –  D. Thomine Mar 1 '12 at 12:52

Any such $n$ gives a $(n+1)$-digit "permutable" or "absolute" prime. Clearly $n=0,1,2$ work, and it's conjectured that there are no absolute primes other than repunits larger than 991.

As hinted by @Sp3000, if 10 is a primitive root mod a prime $p$ then if $n>p$ then $p-1$ must divide $n+1$. According to this paper by Slinko, by considering all such primes up to $10^5$ Richert came up with a lower bound on the number of digits $>6\times 10^{175}$. The paper details which forms of numbers cannot be permutable primes, but notably multiple 1s and a single 3 is one of the few forms that remains as a possibility, implying that this case is still open.

Related, this article attributes the problem with several 1s and one 7 to Slinko and notes it as considered for the IMO. That version is resolved by Theorem 3 in the paper I cited above.

-

$1...31 \ - \ 1...13=18\\ 1...311 \ - \ 1...131=180\\ 1...3111 \ - \ 1...1311=1800$

If $1...113\equiv x \mod 17$ then $1...131\equiv x+18 \mod 17\equiv x+1 \mod17$ and $1...311\equiv x+18+180 \mod 17\equiv x+11 \mod17$.

The first 50 terms in this sequence contain every possible residue$\mod 17$ therefore if none of the permutations is a multiple of $17$ then $n\leq 50$. I checked all $n$ up to $50$ and the only solutions I found were $0,1,2$.

-
If $n=95$, none of the $96$ integers with $95$ ones and one three are divisible by $17$. In fact, this happens for every $n\equiv47\pmod{48}$. –  Julián Aguirre Mar 2 '12 at 15:40