OFFSET
2,1
COMMENTS
a(n) = n if and only if n is prime.
If n is in A046315, a(n) = -1.
LINKS
Robert Israel, Table of n, a(n) for n = 2..10000
EXAMPLE
a(12) = 7 because 7 = 3+4 is prime where 12 = 3*4, and no smaller prime works. This could also be done as 7 = 2+2+3 where 12 = 2*2*3.
MAPLE
G:= proc(S, n) option remember; local s, Sp;
if n = 1 then return {[]} fi;
Sp:= select(t -> n mod t = 0, S);
if Sp = {} then return {} fi;
s:= Sp[1];
map(t -> [s, op(t)], procname(S, n/s)) union procname(S[2..-1], n)
end proc:
f:= proc(n) local S;
S:= map(t -> convert(t, `+`), G(numtheory:-divisors(n) minus {1}, n));
subs(infinity=-1, min(select(isprime, S)))
end proc:
map(f, [$2..100]);
PROG
(PARI) mpartitions(k) = my(v, u); v=[[k]]; fordiv(k, d, if(d>1 && d<=sqrt(k), if(isprime(k/d), v=concat(v, [[d, k/d]]), u=mpartitions(k/d)); for(j=1, #u, if(vecprod(concat(d, u[j])) == k, v = concat(v, [vecsort(concat(d, u[j]))]))))); vecsort(Set(v))
a(n) = n=vecmin(apply(p->if(isprime(p=vecsum(p)), p, oo), mpartitions(n))); if(n<oo, n, -1) \\ Iain Fox, Jul 10 2022
CROSSREFS
KEYWORD
sign,look
AUTHOR
J. M. Bergot and Robert Israel, Jul 10 2022
STATUS
approved