Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #48 May 26 2023 20:12:20
%S 1,-1,2,3,-1,6,-1,10,15,14,30,11,42,22,70,105,66,210,110,165,154,330,
%T 182,462,170,770,1155,910,2310,858,2730,1430,2145,2002,4290,1870,6006,
%U 2618,10010,15015,7854,30030,13090,19635,15470,39270,17290,46410,24310,51870
%N Maximum product of distinct primes with sum n, or -1 if n is not the sum of distinct primes.
%e 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.
%e 13 = 2 + 11; products are 13 = 13 and 2*11 = 22; 22 > 13, so a(13) = 22.
%o (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}
%Y Cf. A000586, A000792 (the same without condition distinct), A064502 (with min).
%K sign
%O 0,3
%A _Zhao Hui Du_, May 23 2023