login
The cumulative sum (1st digit + 2nd digit + 3rd digit + ... + n-th digit of the sequence) is prime.
0

%I #13 Feb 18 2021 16:16:35

%S 2,1,4,6,40,20,46,8,42,400,60,62,64,26,406,80,48,4000

%N The cumulative sum (1st digit + 2nd digit + 3rd digit + ... + n-th digit of the sequence) is prime.

%C This is the lexicographically earliest sequence of distinct terms > 0 with the property. The sequence stops after a(18) = 4000 as the cumulative sum is 113 at that point and the next prime (127) is impossible to reach with a single digit.

%e 2 is prime, and so are the successive digit sums (2+1=3), (2+1+4=7), (2+1+4+6=13), (2+1+4+6+4=17), (2+1+4+6+4+0=17), (2+1+4+6+4+0+2=19), (2+1+4+6+4+0+2+0=19), etc.

%t s = {}; sum = 0; Do[k = 1; While[MemberQ[s, k] || !AllTrue[(sumd = Accumulate @ IntegerDigits[k]), PrimeQ[sum + #] &], k++]; AppendTo[s, k]; sum += sumd[[-1]], {18}]; s (* _Amiram Eldar_, Feb 17 2021 *)

%Y Cf. A001223 (prime gaps).

%K base,nonn,fini,full

%O 1,1

%A _Eric Angelini_, Feb 17 2021