login
The partial sum a(1)+...+a(n) is prime, and so is the sum of the digits used by those n terms.
1

%I #22 Jan 14 2020 12:07:31

%S 2,1,4,6,24,22,8,42,28,60,26,46,44,40,68,66,112,158,64,86,84,118,62,

%T 88,20,48,156,114,136,138,132,150,116,82,192,176,190,392,198,172,152,

%U 178,240,206,174,282,244,80,154,242,204,202,228,170,246,130,648,110,756,196,194,222,208,266,286,284,280,200

%N The partial sum a(1)+...+a(n) is prime, and so is the sum of the digits used by those n terms.

%C This is the lexicographically earliest sequence of distinct numbers > 0 with this property.

%H Carole Dubois, <a href="/A330536/b330536.txt">Table of n, a(n) for n = 1..5000</a>

%H Carole Dubois, <a href="/A330536/a330536.jpg">Graph and trend curves for terms, digits sums, terms sums</a>

%H Rémy Sigrist, <a href="/A330536/a330536.txt">C++ program for A330536</a>

%e The successive partial sums of terms are prime:

%e (2), (2 + 1) = 3, (2 + 1 + 4) = 7; (2 + 1 + 4 + 6) = 13; (2 + 1 + 4 + 6 + 24) = 37; etc.

%e The successive partial sums of their digits are also prime:

%e (2), (2 + 1) = 3, (2 + 1 + 4) = 7; (2 + 1 + 4 + 6) = 13; (2 + 1 + 4 + 6 + 2 + 4) = 19; etc.

%t Nest[Append[#, Block[{k = 1}, While[Nand[FreeQ[#, k], PrimeQ[Total@ # + k], PrimeQ@ Total@ Flatten@ IntegerDigits[Append[#, k]]], k++]; k]] &, {}, 68] (* _Michael De Vlieger_, Dec 17 2019 *)

%o (C++) See Links section.

%Y Cf. A054408 (smallest positive integer not already in sequence such that the partial sum a(1)+...+a(n) is prime).

%K base,nonn

%O 1,1

%A _Eric Angelini_ and _Carole Dubois_, Dec 17 2019