OFFSET
1,1
COMMENTS
A prime that has more than one expression of the given form is included only once. The first such prime is a(14353) = 6858604873 = 1979*1987+...+7109*7121 = 19949*19961+...+20231*20233.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1) = 2*3+5*7 = 41.
a(2) = 3*5+7*11+13*17 = 313.
a(3) = 17*19+23*29+31*37 = 2137.
a(4) = 5*7+11*13+17*19+23*29+31*37+41*43+47*53 = 6569.
a(5) = 41*43+47*53+59*61 = 7853.
MAPLE
S1:= [0, seq(ithprime(2*i)*ithprime(2*i+1), i=1..100)]:
P1:= ListTools:-PartialSums(S1):
S2:= [0, seq(ithprime(2*i-1)*ithprime(2*i), i=1..100)]:
P2:= ListTools:-PartialSums(S2):
M:= 2*max(S1):
S:= select(t -> t < M and isprime(t), {seq(seq(P1[i]-P1[j], j=i mod 2 + 1 .. i-2, 2), i=1..101)} union {seq(seq(P2[i]-P2[j], j=i mod 2 + 1..i-2, 2), i=1..101)} union {seq(P2[i], i=1..101, 2)}):
sort(convert(S, list));
PROG
(Python)
from sympy import isprime, nextprime, prime
def sp2(lst):
ans = 0
for i in range(0, len(lst), 2): ans += lst[i]*lst[i+1]
return ans
def aupto(nn):
alst, i = [], 1
while True:
consec2i = [prime(j+1) for j in range(2*i)]; sp = sp2(consec2i)
if sp > nn: break
while sp <= nn:
if isprime(sp): alst.append(sp)
consec2i = consec2i[1:] + [nextprime(consec2i[-1])]; sp = sp2(consec2i)
i += 1
return sorted(alst)
print(aupto(261983)) # Michael S. Branicky, Jan 08 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Jan 08 2021
STATUS
approved