Primality of numbers with decimal representation of the form XYZZZZZZZ....

155 Views Asked by At

I have been investigating the following. Take any 2-digits number (e.g. 45 ), and consider the sequence

451, 4511, 45111, 451111, 4511111...

For how many last-digit repetitions will the sequence remain composite ? (or in other words, after how many repetitions will the sequence contain a prime number ?)

It turns out, you need to add 772 1s to break the composite sequence. 451111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 111111 is prime

Sequences 671111..., 871111... and 121111... are the other ones exceeding 100 digits lenght (respectively with 210, 149 and 136 ones in the first prime). Sequence 371111...** remains always composite due to a periodic factors repetition.

The sequences 381111... and 561111... remain composite at least until 3000 digits are added. Just curious to know how long this composite sequence is, and if there is anything special about these 2 numbers (38 & 56) or is the result simply statistically justified, considering that factorization is trivial only for respectively 2/3 and 5/6 of the sequences.

Same question could be applied swapping 1s with 3s,7s or 9s, but in this case, the longest sequence is 9577777..., which remains composite until 2904 7s are added (using Dario Alpern https://www.alpertron.com.ar/ECM.HTM to verify that).

All other non-trivial combinations remain composite only under 200 repetitions.

So, the only open question (for me ) remains: how long are the composite sequences with 1s (38111... and 56111...) ?