login
A391078
Primes that are (product + sum) of a sequence of consecutive primes.
2
11, 23, 47, 167, 227, 251, 359, 479, 719, 1181, 1847, 2111, 2591, 3719, 6719, 7559, 8819, 10607, 12539, 14591, 19319, 27551, 29231, 30071, 31319, 51071, 53819, 68111, 97967, 149759, 155219, 172199, 177239, 195359, 199799, 234239, 273527, 305783, 314711, 339863, 356399, 379451, 417311, 423791
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
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
Sequence in context: A139834 A100558 A126199 * A096342 A066179 A217566
KEYWORD
nonn
AUTHOR
Will Gosnell and Robert Israel, Nov 27 2025
STATUS
approved