2

Consider all numbers that are written with only ones in base $10$, that is, numbers of the form $$ p_n=\sum_{i=1}^{n} 10^{i-1}=\frac{10^n-1}{9}=\underbrace{1.....1}_\text{$n$ $1$s}. $$ Here, $n$ is the number of $1$s in that number. For example, $p_2=11$ and $p_5=11111$.

For which values of $n$ is $p_n$ a prime number? I feel there should be an infinite number of values, but is this true? For example, after a brief computation, I've concluded that, for $1\leq n\leq 10^4 $, $p_n$ is prime if and only if $$ n\in\{2,19,23,317,1031\}, $$ which are also prime numbers.

In some way, it seems that such primes stop here, but it might simply be the case that the next prime is way bigger than $p_{1031}$. If there are indeed infinitely many primes in such form, is there an efficient way of testing whether $p_n$ is a prime, given $n$?

sam wolfe
  • 3,465
  • 3
    A question that is more easily answered is: when is a repunit not a prime number. For example when $n$ is even then it will be divisible by $11$ so these are out. Not much harder to see that if $n$ is not a prime then it cannot be a prime. – Winther Sep 17 '19 at 00:57
  • 3
    OEIS has an entry for these: https://oeis.org/A004023 . You'll probably find out a lot about the problem if you follow the references there. I conjecture that it's not known whether there are infinitely many primes of this sort. – xyzzyz Sep 17 '19 at 01:02
  • 1

2 Answers2

3

$\underbrace{1.....1}_\text{$a \cdot b$ $1$s}$ for some integers a,b

then,

$\underbrace{1.....1}_\text{$a$ $1$s}\underbrace{1.....1}_\text{$a$ $1$s}...\underbrace{1.....1}_\text{$a$ $1$s} $ / $ \underbrace{1.....1}_\text{$a$ $1$s} = integer$

1

It is not necessary for a number with repeated $1$ only to always be prime but it indeed is one of the required conditions for the number to be prime so you can limit the domain.

Suppose, $a_n=\underbrace{11111\dots11}_{n\ times}\implies \left(10^{n-1}+10^{n-2}\dots + 10^{0}\right)\implies \frac{10^n-1}9\qquad\dots (1)$
Here $a_n$ is always an integer

Now let $n$ have factors $p,k(\ne 1)$

Multiply and divide $(1)$ with $(10^p-1)$:

$$a_n\implies \left(\frac{10^{pk}-1}{10^p-1}\right)\left(\frac{10^p-1}9\right)\implies\left(10^p+10^{2p}+10^{3p}\dots10^{pk}\right)a_p$$

So $a_n$ can be written as product of $2$ distinct integers if $n$ is not prime.