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.


Solution 1:

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.

Solution 2:

$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$.