The sum of the a(n) first digits of S is a prime

 

 

Hello SeqFans -- here is another nightmare:

 

« Smallest integer not yet present in S such that the sum of the a(n) first digits of S is a prime »:

 

I get by hand:

 

S = 2,1,4,6,3,7,8,60,9,11,14,17,61,16,22,25,30,26,28,34,49,37,200,36,38,39,42,59,51,54,56,61,69,201,...

 

Sum of the first  2 digits is a prime: 2+1 = 3

Sum of the first  1 digit  is a prime: 2 = 2

Sum of the first  4 digits is a prime: 2+1+4+6 = 13

Sum of the first  6 digits is a prime: 2+1+4+6+3+7= 23

Sum of the first  3 digits is a prime: 2+1+4 = 7

Sum of the first  7 digits is a prime: 2+1+4+6+3+7+8 = 31

Sum of the first  8 digits is a prime: 2+1+4+6+3+7+8+6 = 37

Sum of the first 60 digits is a prime: 2+1+4+6+3+7+8+6+0+9+1+1+1+4+1+7+6+1+1+6+2+2+2+5+3+0+2+6+2+8+3+4+4+9+3+7+2+0+0+

                                        3+6+3+8+3+9+4+2+5+9+5+1+5+4+5+6+6+1+6+9+2 = 241

Sum of the first  9 digits is a prime: 2+1+4+6+3+7+8+6+0 = 37

Sum of the first 11 digits is a prime: 2+1+4+6+3+7+8+6+0+9+1 = 47

Sum of the first 14 digits is a prime: 2+1+4+6+3+7+8+6+0+9+1+1+1+4 = 53

Sum of the first 17 digits is a prime: 2+1+4+6+3+7+8+6+0+9+1+1+1+4+1+7+6 = 67

Sum of the first 61 digits is a prime: 2+1+4+6+3+7+8+6+0+9+1+1+1+4+1+7+6+1+1+6+2+2+2+5+3+0+2+6+2+8+3+4+4+9+3+7+2+0+0+

                                        3+6+3+8+3+9+4+2+5+9+5+1+5+4+5+6+6+1+6+9+2+0 = 241

Sum of the first 16 digits is a prime: 2+1+4+6+3+7+8+6+0+9+1+1+1+4+1+7 = 61

...               |

                  |

->Above column is S

 

In computing this, one is forced to put constraints on the future of S. See here, for instance:

 

S = 2,1,4,...

 

As we cannot write "3" after "1" (because the sum of the first "3" digits would be 6 -- a composite), we write "4" -- leaving the future "open". But this "4" forces the next term, 6:

 

S = 2,1,4,6,...

 

And again, this "6" puts a constraint on the future of S. "3" is forced, as "3" is the « smallest integer not yet present in S such that the sum of the a(n) first digits of S is a prime »; indeed, it works, "3" describes the "past" of S and 2+1+4=7, a prime.

 

S = 2,1,4,6,3,7,...

 

"7" resolves the constraint put by "6"; indeed the sum of the first 6 digits of S is a prime -- "7" being the smallest available integer: 2+1+4+6+3+7= 23

 

This "7" puts another constraint on the future of S -- resolved by "8":

 

S = 2,1,4,6,3,7,8,... Check:  2+1+4+6+3+7+8 = 31, ok.

 

This "8", again, puts a constraint on the next term -- and we notice quickly that we must take "60" as the next term! If we could have taken "6" instead, we would have had a prime sum (31+6=37) -- but 6 was already in S! We must try something else -- and after having checked that no smallest integer fits, we write "60" after "8":

 

S = 2,1,4,6,3,7,8,60,...

 

This puts a huge constraint on S! We have to remember that the sum of the first 60 digits of S is a prime!

 

Nevertheless, we proceed... (fast forward until):

 

S = 2,1,4,6,3,7,8,60,9,11,14,17,61,16,22,25,30,26,28,...

 

The above last digit ("8") is the 30st of S; the digit sum so far is 107;

 

What would be the next term "xy", after 28? All "past" prime sums have been described so far -- thus we write "for the future" and try "31":

 

S = 2,1,4,6,3,7,8,60,9,11,14,17,61,16,22,25,30,26,28,31,...

 

No -- the "3" of "31" is the 31st digit of S; as 107+"3" is 110 (composite) we cannot keep "31". We try "32":

 

S = 2,1,4,6,3,7,8,60,9,11,14,17,61,16,22,25,30,26,28,32,...

 

No again: the sum of the 32 first digits would now be 107+"3"+"2" = 112, a composite.

 

"33" seems ok -- as the sum of the 33 first digits is prime (read the "nth digit" vertically and the cumulative sums "CS" vertically too):

 

nth = 1 2 3 4 5 6 7 89 1 11 11 11 11 12 22 22 22 22 23 33 33

nth                    0 12 34 56 78 90 12 34 56 78 90 12 34

S = 2,1,4,6,3,7,8,60,9,11,14,17,61,16,22,25,30,26,28,33,xy

CS= 2 3 7 1 1 2 3 33 4 44 45 56 66 67 77 88 88 99 91 11 .

CS        3 6 3 1 77 6 78 93 41 78 95 79 16 99 17 90 11 .

                                                   7 03 .

 

Ouch... We have a problem with the next digit, "x"! No digit will fit, as the closest prime to 113 is 127 -- 14 units apart! We see that 33 puts too strong a constraint on the future of S -- a halting one! We thus erase "33" and try "34" (shouting ‘alleluia’ here to the inventor of the copy/paste technique):

 

nth =1 2 3 4 5 6 7 89 1 11 11 11 11 12 22 22 22 22 23 33 33

nth                   0 12 34 56 78 90 12 34 56 78 90 12 34

S = 2,1,4,6,3,7,8,60,9,11,14,17,61,16,22,25,30,26,28,34,xy ...

CS= 2 3 7 1 1 2 3 33 4 44 45 56 66 67 77 88 88 99 91 11 .

CS        3 6 3 1 77 6 78 93 41 78 95 79 16 99 17 90 11 .

                                                   7 04 .

 

Now, with "34", we have 2 available digits to bridge the gap; the smallest integer fitting will be 49:

 

nth= 1 2 3 4 5 6 7 89 1 11 11 11 11 12 22 22 22 22 23 33 33

nth                   0 12 34 56 78 90 12 34 56 78 90 12 34

S = 2,1,4,6,3,7,8,60,9,11,14,17,61,16,22,25,30,26,28,34,49, ...

CS= 2 3 7 1 1 2 3 33 4 44 45 56 66 67 77 88 88 99 91 11 11

CS        3 6 3 1 77 6 78 93 41 78 95 79 16 99 17 90 11 12

                                                   7 04 87

Etc.

I don’t now if such a seq can exist; there might be for ever the doubt that we have to erase a lot of terms in order to proceed -- and "a lot of terms" might force us, at some (far away) point, NOT to start with S = 2,1,4,6,3,7,8,60,...

 

Best,

É.

 

__________

 

Maximilian Hasler was quick to submit this:

 

[Éric] :

> S = 2,1,4,6,3,7,8,60,9,11,14,17,61,16,22,25,30,26,28,34,49,37,200,36,38,39,42,59,51,54,56,61,69,201,...

 

[Maximilian]:

not bad... but I get something different for the last 3 of your terms, when I compute some more :

The following 86 terms satisfy the criteria ("so far"):

 

[2, 1, 4, 6, 3, 7, 8, 60, 9, 11, 14, 17, 61, 16, 22, 25, 30, 26, 28, 34, 49, 37, 200, 36, 38, 39, 42, 59, 51, 54, 56, 62, 71, 600, 65, 70, 66, 75, 201, 72, 67, 68, 82, 100, 83, 84, 91, 93, 300, 94, 95, 301, 98, 101, 103, 110, 116, 120, 302, 121, 130, 132, 202, 133, 141, 500, 142, 143, 148, 150, 154, 155, 165, 303, 166, 174, 203, 175, 183, 204, 184, 192, 196, 290, 208, 800, ...]

 

__________

 

Douglas McNeil answered:

 

[Éric] :

>> S = 2,1,4,6,3,7,8,60,9,11,14,17,61,16,22,25,30,26,28,34,49,37,200,36,38,39,42,59,51,54,56,61,69,201,...

 

[Doug]:

> but this has 61 twice

 

[Éric] :

... aaargghllll!

 

[Doug]:

M. Hasler wrote:

 

> [2, 1, 4, 6, 3, 7, 8, 60, 9, 11, 14, 17, 61, 16, 22, 25, 30, 26, 28, 34, 49, 37, 200, 36, 38, 39, 42, 59, 51, 54, 56, 62, 71, 600, 65, 70, 66, 75, 201, 72, 67, 68, 82, 100, 83, 84, 91, 93, 300, 94, 95, 301, 98, 101, 103, 110, 116, 120, 302, 121, 130, 132, 202, 133, 141, 500, 142, 143, 148, 150, 154, 155, 165, 303, 166, 174, 203, 175, 183, 204, 184, 192, 196, 290, 208, 800, ...]

... which seems to self-describe so far, but I find

 

sage: S[:100]

[2, 1, 4, 6, 3, 7, 8, 60, 9, 11, 14, 17, 61, 16, 22, 25, 30, 26, 28, 34, 49, 37, 200, 36, 38, 39, 42, 59, 51, 54, 56, 62, 68, 2000, 63, 67, 80, 69, 70, 72, 73, 82, 90, 600, 81, 83, 91, 601, 84, 92, 97, 103, 201, 104, 106, 107, 112, 113, 120, 126, 130, 202, 131, 139, 400, 138, 140, 141, 144, 148, 153, 163, 203, 164, 168, 172, 178, 181, 900, 182, 183, 187, 196, 500, 280, 800, 197, 198, 204, 206, 208, 224, 290, 225, 232, 602, 233, 234, 238, 246]

 

which I think also self-describes but disagrees from the 33rd term, which I take as 68. I didn’t use a search limit, which probably explains the difference as the next term seems to be 2000.

 

But who knows? If the above is right (even setting aside the possibility of backward-propagating blockers later, which I’m too sleepy to think about) it’d be the only time I’d ever successfully computed one of Eric’s self-referencing sequences in any of the first half-dozen attempts..

 

Doug

 

__________

 

Maximilian:

 

I confirm Doug’s terms:

By setting my search limit to 3000, I get the same first 100 terms (How come I did not think of trying this??), and they remain stable when I calculate 200 of them.

 

But the fact that my terms were consistent to over 85 terms but wrong from the 33rd one on, makes it clear how little we can trust in these results...

(Which does not mean that the question of existence of the sequence is hopeless to answer, IMO).

 

Maximilian

 

try2complete(100,,2001)

[2, 1, 4, 6, 3, 7, 8, 60, 9, 11, 14, 17, 61, 16, 22, 25, 30, 26, 28, 34, 49, 37, 200, 36, 38, 39, 42, 59, 51, 54, 56, 62, 68, 2000, 63, 67, 80, 69, 70, 72, 73, 82, 90, 600, 81, 83, 91, 601, 84, 92, 97, 103, 201, 104, 106, 107, 112, 113, 120, 126, 130, 202, 131, 139, 400, 138, 140, 141, 144, 148, 153, 163, 203, 164, 168, 172, 178, 181, 900, 182, 183, 187, 196, 500, 280, 800, 197, 198, 204, 206, 208, 224, 290, 225, 232, 602, 233, 234, 238, 246]

 

try2complete(200,,2001) =

[2, 1, 4, 6, 3, 7, 8, 60, 9, 11, 14, 17, 61, 16, 22, 25, 30, 26, 28, 34, 49, 37, 200, 36, 38, 39, 42, 59, 51, 54, 56, 62, 68, 2000, 63, 67, 80, 69, 70, 72, 73, 82, 90, 600, 81, 83, 91, 601, 84, 92, 97, 103, 201, 104, 106, 107, 112, 113, 120, 126, 130, 202, 131, 139, 400, 138, 140, 141, 144, 148, 153, 163, 203, 164, 168, 172, 178, 181, 900, 182, 183, 187, 196, 500, 280, 800, 197, 198, 204, 206, 208, 224, 290, 225, 232, 602, 233, 234, 238, 246, 248, 253, 401, 252, 254, 265, 402, 266, 269, 271, 278, 403, 281, 285, 340, 291, 292, 294, 295, 301, 309, 312, 317, 360, 318, 321, 328, 329, 333, 337, 341, 901, 346, 801, 347, 350, 355, 369, 357, 365, 373, 410, 378, 379, 603, 380, 382, 383, 384, 393, 404, 502, 604, 409, 501, 413, 418, 802, 419, 424, 428, 433, 605, 434, 437, 438, 441, 442, 447, 457, 503, 458, 464, 469, 1000, 470, 471, 472, 485, 902, 486, 488, 493, 499, 606, 607, 504, 510, 511, 513, 515, 521, 526, 531, 690, 532, 538, 542, 700, 543]

 

__________

 

 

We now have 200 stable terms: many thanks to both of you, Maximilian and Doug!

 

Best,

É.

[Augustus 31st, 2010]