login
Starting with composite(n) go on adding smaller composite numbers until one gets a prime. a(n) = this prime, or 0 if no such prime exists.
1

%I #16 Sep 23 2023 04:29:50

%S 0,0,0,17,19,31,53,29,31,0,83,41,43,67,71,97,53,173,223,349,337,67,

%T 337,71,109,113,79,359,239,89,0,139,97,193,101,103,157,109,367,113,

%U 383,443,293,761,127,1021,131,199,137,139,211,353,149,151,647,659,311,239,163

%N Starting with composite(n) go on adding smaller composite numbers until one gets a prime. a(n) = this prime, or 0 if no such prime exists.

%C Conjecture: No entry is zero for n >10. There are only four terms which are zero.

%C The conjecture is false as a(31) is zero. There is, however, no further zero up to a(26754), so the conjecture may be rephrased as: no entry is zero for n>31 and there are only five terms which are zero. - _Harvey P. Dale_, May 04 2015

%H Harvey P. Dale, <a href="/A085106/b085106.txt">Table of n, a(n) for n = 1..1000</a>

%e Composite(6) = 12 and 12+10+9 = 31 hence a(6) = 31.

%t With[{c=Reverse[Select[Range[100],CompositeQ]]},SelectFirst[#,PrimeQ]&/@Table[Accumulate[Take[c,-n]],{n,Length[c]}]]/.{Missing["NotFound"] -> 0} (* The program uses the SelectFirst function from Mathematica version 10 *) (* _Harvey P. Dale_, May 04 2015 *)

%o (PARI) for (n = 4, 120, if (!isprime(n), s = n; k = n - 1; while (!isprime(s) && k > 3, if (!isprime(k), s += k); k--); print1(if (isprime(s), s, 0), " "))); \\ _David Wasserman_, Jan 27 2005

%Y Cf. A085105.

%K nonn

%O 1,4

%A _Amarnath Murthy_ and Meenakshi Srikanth (menakan_s(AT)yahoo.com), Jul 04 2003

%E More terms from _David Wasserman_, Jan 27 2005