login
A363266
Maximum product of distinct primes with sum n, or -1 if n is not the sum of distinct primes.
1
1, -1, 2, 3, -1, 6, -1, 10, 15, 14, 30, 11, 42, 22, 70, 105, 66, 210, 110, 165, 154, 330, 182, 462, 170, 770, 1155, 910, 2310, 858, 2730, 1430, 2145, 2002, 4290, 1870, 6006, 2618, 10010, 15015, 7854, 30030, 13090, 19635, 15470, 39270, 17290, 46410, 24310, 51870
OFFSET
0,3
EXAMPLE
Expressed as a sum of distinct primes, 12 = 5 + 7 = 2 + 3 + 7. Products are 5*7 = 35 and 2*3*7 = 42; 42 > 35, so a(12) = 42.
13 = 2 + 11; products are 13 = 13 and 2*11 = 22; 22 > 13, so a(13) = 22.
PROG
(PARI) alist(n)={local(v); v=vector(n, x, -1); forprime(p=2, n, forstep(h=n, p+1, -1, v[h]=max(v[h], v[h-p]*p)); v[p]=max(v[p], p)); v}
CROSSREFS
Cf. A000586, A000792 (the same without condition distinct), A064502 (with min).
Sequence in context: A256470 A318198 A335195 * A083855 A062565 A175137
KEYWORD
sign
AUTHOR
Zhao Hui Du, May 23 2023
STATUS
approved