Note this question is subtly different to the question Can I infinitely prepend a digit to some number and always get primes?. This question has previously been closed as a duplicate of that question - it is not!
That question aks for an infinite sequence of primes similar to the finite sequences I describe. I ask whether it is possible to find a finite sequence of length $k$, for all $k$, which is not the same thing. The sole answer on that question notable says it does not prove that there can't be a maximum such $k$, and so does not answer this question.
A famous "pattern" in the primes is
$$ \begin{align} 31 & \text{ is prime} \\ 331 & \text{ is prime} \\ 3331 & \text{ is prime} \\ 33331 & \text{ is prime} \\ 333331 & \text{ is prime} \\ 3333331 & \text{ is prime} \\ 33333331 & \text{ is prime} \end{align} $$
but this breaks at $333333331=17 \times19607843$.
Let's generalize this. Write $a \oplus b$ for the decimal concatenation of two numbers $a, b$, e.g. $12 \oplus 34 = 1234$.
Then for $a \in \{1,...,9\}$, $b \in \mathbb{N}$, we call $(a,b)$ a prepend prime pattern of length $k$ if $b$ is prime, $a \oplus b$ is prime, ..., $\underbrace{a \oplus \dots \oplus a}_{k-1} \oplus b$ is prime.
As an example, we have seen that $(3,31)$ is a prepend prime pattern of length $7$.
Question: can we find arbitrarily long finite prepend prime patterns? That is, for any $k \in \mathbb{N}$, can I find a prepend prime pattern of length $k$?
Here's what I've observed so far.
First, we can narrow down conditions on $a$ quite a bit. Let's observe that for a prepend prime pattern to be length $2$ or more with $b > 3$, we require $a \in \{3, 6, 9\}$. Indeed, we'll require, for $m$ the length of $b$ in decimal digits,
$$\begin{align} b & \text{ is prime} \\ a * 10^m + b & \text{ is prime} \\ a * 10^{m+1} + a * 10^m + b & \text{ is prime} \\ \end{align}$$
So, modulo $3$, we need $b, a+b, 2a+b \not \equiv 0 \mod 3$. We require that $b$ is prime, so the first is true, and if $3 \mid a$, then the rest are also true. But if $3 \not \mid a$, then we get $a \equiv \pm 1 \mod 3$ and deduce that one of $a+b, 2a+b \equiv 0 \mod 3$.
I used this to check by computer the total number of prepend prime patterns of length $3$ or more below $5 \times 10^7$. I found patterns of length $8$ and $9$ (beating $(3,31)$) but none of length $10$:
| $k$ | Prepend prime patterns of length $k$ (exactly) | Prepend prime patterns of length $k$ or more |
|---|---|---|
| $3$ | $234216$ | $272853$ |
| $4$ | $34291$ | $38637$ |
| $5$ | $4013$ | $4346$ |
| $6$ | $282$ | $333$ |
| $7$ | $44$ | $51$ |
| $8$ | $6$ | $7$ |
| $9$ | $1$ | $1$ |
I suspect that the number of prepend primes of length $k$ or more below some number decays exponentially as $k$ increases. Indeed, within this data:
| $k$ | Prepend prime patterns of length $k$ or more | Proportion of previous retained |
|---|---|---|
| $3$ | $272853$ | n/a |
| $4$ | $38637$ | $0.141603721$ |
| $5$ | $4346$ | $0.112482853$ |
| $6$ | $333$ | $0.076622181$ |
| $7$ | $51$ | $0.153153153$ |
| $8$ | $7$ | $0.137254902$ |
| $9$ | $1$ | $0.142857143$ |
Very roughly, on average in the above data, about $13 \%$ of the prepend prime patterns are retained as we increase $k$ by $1$.
Heuristically then, I suspect that if the above proportions decay exponentially, it should be possible to find a prepend prime pattern of arbitrary length, it's just going to get increasingly hard to do so. This of course does not prove that this is the case.
Also, here are the solutions of length $\geq 7$ for $b \leq 5 \times 10^7$.
| $k$ | Prepend prime patterns $(a,b)$ of length $k$ (exactly) |
|---|---|
| $7$ | $(3,31)$, $(3, 4549)$, $(3, 37013)$, $(6, 559667)$, $(3, 1827589)$, $(9, 2177297)$, $(9, 2261297)$, $(3, 2847839)$, $(6, 2940793)$, $(9, 3365617)$, $(3, 3606583)$, $(9, 4209859)$, $(6, 4855237)$, $(3, 5633867)$, $(9, 5864687)$, $(6, 5941049)$, $(6, 6055541)$, $(6, 6347707)$, $(3, 6742709)$, $(9, 8275459)$, $(6, 8616281)$, $(6, 9682997)$, $(6, 10281809)$, $(3, 12515779)$, $(9,14820899)$, $(6, 17024377)$, $(6, 17892377)$, $(6, 18586343)$, $(3, 23324297)$, $(6, 32240291)$, $(6, 33563039)$, $(6, 36680251)$, $(3, 38210987)$, $(3, 39890069)$, $(6, 39949517)$, $(9, 40615409)$, $(9, 42202813)$, $(9, 42268879)$, $(6, 42408953)$, $(9, 42908623)$, $(3, 43412309)$, $(3, 45672287)$, $(3, 46130017)$, $(9, 49531771)$ |
| $8$ | $(3, 7013)$, $(6, 347707)$, $(3, 8210987)$, $(6, 23233349)$, $(9, 39804473)$, $(6, 45556349)$ |
| $9$ | $(9, 4128253)$ |