login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A372406
a(n) is the size of the largest set of positive integers S from 1..prime(n)-1 such that for any subset R of S, Sum {R} + prime(n) is prime.
1
1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 3, 4, 4, 4, 4, 3, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
OFFSET
1,4
COMMENTS
This sequence is not monotonically increasing.
EXAMPLE
Let n=5, so p=prime(5)=11. From A070046, there are 3 positive integers x such that 1 <= x < 11 and 11+x is prime, which are {2, 6, 8}, so a(5) <= 3. Next, we see that 11 + 2 + 6 + 8 = 27 which is not prime so a(5) < 3. Last, we see that 11 + 2 + 6 = 19 is prime, and we already checked that 11 + 2 and 11 + 6 were prime, so S = {2, 6} and a(5) = 2.
11 is the first n such that a(n) = 3. Here, prime(11) = 31, and there are multiple sets which work. One is S = {6, 22, 30}.
31 + {} = 31 (empty set subset of S),
31 + 6 = 37,
31 + 22 = 53,
31 + 30 = 61,
31 + 6 + 22 = 59,
31 + 6 + 30 = 67,
31 + 22 + 30 = 83,
31 + 6 + 22 + 30 = 89, all of which are prime.
28 is the first n such that a(n) = 4. Here, prime(28) = 107, and there are multiple sets which work. One is S = {2, 30, 42, 90}.
MAPLE
f:= proc(n)
local k, p, C, S, s, t, q;
p:= ithprime(n);
C:= select(isprime, [$p+1 .. 2*p-1]) -~ p;
S[1]:= map(t -> [{t}, {0, t}], C);
for k from 2 do
S[k]:= NULL;
for s in S[k-1] do
for t in select(`>`, C, max(s[1])) do
q:= s[2] +~ t;
if andmap(isprime, q +~ p) then
S[k]:= S[k], [s[1] union {t}, s[2] union q] ;
fi
od od;
S[k]:= {S[k]};
if S[k] = {} then return k-1 fi
od
end proc:
map(f, [$1..90]); # Robert Israel, May 06 2024
MATHEMATICA
nmax = 87; a372406 = {{1, 1}};
For[n = 2, n <= nmax, n++, d = {}; p = Prime[n];
For[a = 2, a < p, a += 2, If[PrimeQ[p + a], AppendTo[d, a]]]; q = 1; k = 0;
While[q == 1 && k <= Length[d], k++; su = Subsets[d, {k}];
For[i = 1, i <= Length[su], i++, s = su[[i]];
If[PrimeQ[Total[s] + p], y = Subsets[s]; t = 1;
For[z = 1, z <= Length[y], z++,
If[CompositeQ[Total[y[[z]]] + p], t = 0; q = 0; Break[]]];
If[t == 1, q = 1; Break[]], q = 0]]];
AppendTo[a372406, {n, k - 1}]]
Print[a372406]
CROSSREFS
Cf. A070046.
Sequence in context: A055980 A076080 A134914 * A329195 A204164 A257639
KEYWORD
nonn
AUTHOR
Samuel Harkness, Apr 29 2024
STATUS
approved