Problems & Puzzles: Puzzles

Puzzle 1182  Another sequence by Paolo Lava

Paolo Lava sent the following puzzle:

Let us consider this sequence: a(1) = 1; a(n) counts the number of digits (n mod 10) already present in the sequence. (this one is not yet in OEIS)

Here below the first terms:

1, 0, 0, 0, 0, 0, 0, 0, 0, 8, 1, 0, 0, 0, 0, 0, 0, 1, 0, 15, 4, 0, 0, 1, 1, 0, 0, 1, 0, 20, 7, 1, 0, 1, 1, 0, 1, 1, 0, 24, 12, 3, 1, 2, 1, 0, 1, 1, 0, 26, 17, 5, 1, 2, 2, 1, 2, 1, 0, 27, 21, 10, 1, 2, 2, 1, 3, 1, 0, 29, 26, 14, 2, 3, 2, 2, 3, 1, 1, 29, 29, 19, 4, ...

E.g. a(1)=1, then a(2) tells the number of (2 mod 10) = 2 already present in the sequence, that are 0. The same up to a(9). For a(10) we have 8 because the number of (10 mod 10) = 0 already present are 8. Again, for instance, a(21) = 4 because the number of (21 mod 10) = 1 already present are 4 (a(1) = 1, a(11) = 1, a(18) = 1 and there is a "1" in a(20) =15).

I tested up to 2*10^4. The distribution of digits should follow Benford's law: the sequence is mostly populated by digit "1", with digit "0" to the other extreme.

Here below is a graph of the number of different digits for the first 2*10^4 terms.

The first consecutive different primes for exactly k values are:

k = 1 -> [7] for n = 31.
k = 2 -> [17,5] for n = 51, 52.
k = 3 -> [7, 3, 5] for n = 104, 105, 106.
k = 4 -> [2351, 2467, 2477, 2437] for n = 8677, 8678, 8679, 8680.
k = 5 -> [421, 467, 443, 401, 433] for n = 2096, 2097, 2098, 2099, 2100.

Q1. Can you extend the list for k>5?

And what about the same prime in consecutive positions? I found only primes in two consecutive positions. Here below the list:

 Prime n 2 54, 55 2 64, 65 2 75, 76 29 80, 81 2 85, 86 5 116, 117 11 165, 166 113 552, 553 109 695, 696 223 972, 973 223 1317, 1318 251 1386, 1387 1109 3602, 3603 1481 5268, 5269 2767 9837, 9838 3517 12278, 12279

Q2.Are there primes in 3 or more consecutive positions?

From July 27 to August 2, contributions came from Michael Branicky, Oscar Volpatti

***

Michael wrote:

In a search to n = 3900000, there were no consecutive different primes for k > 5.
There were also no primes in 3 or more consecutive positions.
However, I did note the following additional primes that appeared consecutively:

{Prime}  [Positions, n]
{10253} [28265, 28266]
{27817} [72948, 72949]
{41023} [105947, 105948]
{87631} [177335, 177336]
{105929} [223875, 223876]
{110161} [235065, 235066]
{191827} [388706, 388707]
{289291} [589187, 589188]
{374587} [775018, 775019]
{376501} [779228, 779229]
{390989} [797357, 797358]
{515153} [1049159, 1049160]
{1059703} [1816825, 1816826]
{1404391} [2484297, 2484298]

***

Oscar wrote:

I searched up to n = 10^11, finding up to 7 consecutive different primes.
k = 6 for n = 30664894 to 30664899:
[21063803, 21015143, 21017179, 21042563, 21008749, 21213799];
k = 7 for n = 4177543292 to 4177543298:
[4791305951, 4581728891, 3981290023, 3759700661, 3748019419, 3706080449, 3685762669]

After the initial blocks of consecutive zeros, only one integer was repeated in three consecutive positions:
composite 3523 = 13*271, for n = 12298 to 12300.

The digit distribution seems to slowly converge to an uniform distibution.
Up to n = 10^11, sequence a(n) contains 1097115139236 digits:
118805572854 times digit 1,
108902446070 times digit 2,
108812221676 times digit 3,
108938212584 times digit 4,
108846092302 times digit 5,
108963402346 times digit 6,
108987641787 times digit 7,
108873703624 times digit 8,
108290836377 times digit 9,
107695009616 times digit 0.
So far, digit 1 is present only about 10% more times than digit 0.

***

 Records   |  Conjectures  |  Problems  |  Puzzles