OFFSET
1,1
COMMENTS
Is 23 the only term in common with A390933, i.e. a prime that is both (product - sum) of a sequence of consecutive primes and (product + sum) of a sequence of consecutive primes?
No other term in common for n <= 10^8. - Michael S. Branicky, Dec 01 2025
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(3) = 47 is a term because 47 = 5*7 + 5 + 7 is prime, where 5 and 7 are consecutive primes.
MAPLE
N:= 1000: # for terms <= N^2
P:= select(isprime, [2, seq(i, i=3..N, 2)]): nP:= nops(P):
M:= N^2:
R:= {}:
for i from 1 to nP do
p:= P[i]; s:= P[i];
for j from i+1 to nP do
p:= p * P[j]; s:= s + P[j];
v:= p+s;
if v > M then break fi;
if isprime(v) then R:= R union {v} fi;
od
od:
sort(convert(R, list));
PROG
(Python)
import heapq
from itertools import islice
from sympy import isprime, sieve
def agen(): # generator of terms
pp, ss, nextcount, alst, oldv = 6, 5, 3, [], -1
h = [(pp+ss, pp, ss, 1, 2)]
while True:
(v, pr, sm, s, l) = heapq.heappop(h)
if v > oldv and isprime(v):
yield v
oldv = v
if v >= pp:
pp *= sieve[nextcount]
ss += sieve[nextcount]
heapq.heappush(h, (pp+ss, pp, ss, 1, nextcount))
nextcount += 1
pr //= sieve[s]; sm -= sieve[s]; s += 1; l += 1; pr *= sieve[l]; sm += sieve[l]
heapq.heappush(h, (pr+sm, pr, sm, s, l))
return alst
print(list(islice(agen(), 44))) # Michael S. Branicky, Nov 30 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Will Gosnell and Robert Israel, Nov 27 2025
STATUS
approved
