%I #72 Jan 14 2023 12:16:17
%S 2,29,293,229,3119,67,18121,59629,10247,15391,5903,24007,11783,39359,
%T 21013,104917,38273,61129,23663,2423
%N a(n) is the least prime p that starts a run of 2n+1 consecutive primes whose product is a sum of the same number of (others or same) consecutive primes.
%H Jean-Marc Rebert, <a href="/A352065/a352065_2.txt">doubleDecomposition</a>
%H Carlos Rivera, <a href="https://www.primepuzzles.net/puzzles/puzz_1077.htm">Puzzle 1077. These numbers that are...</a>, The Prime Puzzles and Problems Connection.
%e a(0) = 2, because 2 = 2, and there is no smaller prime.
%e a(1) = 29, because 29 * 31 * 37 = 33263 = 11083 + 11087 + 11093, and there is no smaller prime that starts a run of 3 consecutive primes whose product is a sum of 3 consecutive primes.
%e a(2) = 293, because 293 * 307 * 311 * 313 * 317 = 2775683761181 = 555136752211 + 555136752221 + 555136752227 + 555136752251 + 555136752271, and there is no smaller prime that starts a run of 5 consecutive primes whose product is a sum of 5 consecutive primes.
%e Let y be the product of the 2n+1 consecutive primes starting with a(n) and let q be the first prime in the sum of 2n+1 consecutive primes. For n = 0..3 we have:
%e .
%e n 2n+1 a(n) y #dgts(y) q #dgts(q)
%e - ---- ---- ----------------- -------- ---------------- --------
%e 0 1 2 2 1 2 1
%e 1 3 29 33263 5 11083 5
%e 2 5 293 2775683761181 13 555136752211 12
%e 3 7 229 52139749485151463 17 7448535640735789 16
%e .
%e For more examples, see the "doubleDecomposition" link.
%o (Python)
%o from math import prod
%o from sympy import prime, nextprime, prevprime
%o def A352065(n):
%o plist = [prime(k) for k in range(1,2*n+2)]
%o pd = prod(plist)
%o while True:
%o mlist = [nextprime(pd//(2*n+1)-1)]
%o for _ in range(n):
%o mlist = [prevprime(mlist[0])]+mlist+[nextprime(mlist[-1])]
%o if sum(mlist) <= pd:
%o while (s := sum(mlist)) <= pd:
%o if s == pd:
%o return plist[0]
%o mlist = mlist[1:]+[nextprime(mlist[-1])]
%o else:
%o while (s := sum(mlist)) >= pd:
%o if s == pd:
%o return plist[0]
%o mlist = [prevprime(mlist[0])]+mlist[:-1]
%o pd //= plist[0]
%o plist = plist[1:] + [nextprime(plist[-1])]
%o pd *= plist[-1] # _Chai Wah Wu_, Apr 21 2022
%Y Cf. A203619, A323052.
%K nonn,hard,more
%O 0,1
%A _Jean-Marc Rebert_, Mar 05 2022
%E a(15)-a(19) from _Chai Wah Wu_, Apr 21 2022