OFFSET
0,3
COMMENTS
A partition is prime if all parts are primes. A partition of an odd integer is minimal if it has at most one odd part and is shorter than any other such partition. A partition of an even integer n > 2 is minimal if it has at most two parts, one of which is the greatest prime less than n - 1. The terms of the sequence are the products of these partitions. For n in {0, 1, 2} a(n) = n by convention.
LINKS
Eric Weisstein's World of Mathematics, Prime Partition
EXAMPLE
n a(n) partition
2 2 [2]
3 3 [3]
4 4 [2, 2]
5 5 [5]
6 9 [3, 3]
7 7 [7]
8 15 [5, 3]
9 14 [7, 2]
10 21 [7, 3]
11 11 [11]
12 35 [7, 5]
13 13 [13]
14 33 [11, 3]
15 26 [13, 2]
16 39 [13, 3]
17 17 [17]
18 65 [13, 5]
19 19 [19]
20 51 [17, 3]
MAPLE
a := proc(n) local r, p;
if n <= 2 then return n fi;
if n::odd then
if isprime(n) then return n fi;
r := prevprime(n);
p := [seq(2, i=1..(n + 1 - r)/2), r]
else
r := prevprime(n - 1);
p := [n - r, r]
fi;
return mul(k, k in p)
end: seq(a(n), n = 0..61);
PROG
(SageMath)
def a(n):
if n <= 2: return n
if n % 2 == 1:
if is_prime(n): return n
r = previous_prime(n)
p = [r] + [2]*((n + 1 - r)//2)
else:
r = previous_prime(n - 1)
p = [r, n - r]
return mul(p)
print([a(n) for n in range(40)])
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, Sep 08 2019
STATUS
approved