%I #14 Feb 26 2020 07:15:03
%S 0,1,2,3,4,5,9,7,15,14,21,11,35,13,33,26,39,17,65,19,51,38,57,23,95,
%T 46,69,92,115,29,161,31,87,62,93,124,155,37,217,74,111,41,185,43,123,
%U 86,129,47,215,94,141,188,235,53,329,106,159,212,265,59,371,61
%N Representation of integers by the product of prime partitions.
%C 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.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PrimePartition.html">Prime Partition</a>
%e n a(n) partition
%e 2 2 [2]
%e 3 3 [3]
%e 4 4 [2, 2]
%e 5 5 [5]
%e 6 9 [3, 3]
%e 7 7 [7]
%e 8 15 [5, 3]
%e 9 14 [7, 2]
%e 10 21 [7, 3]
%e 11 11 [11]
%e 12 35 [7, 5]
%e 13 13 [13]
%e 14 33 [11, 3]
%e 15 26 [13, 2]
%e 16 39 [13, 3]
%e 17 17 [17]
%e 18 65 [13, 5]
%e 19 19 [19]
%e 20 51 [17, 3]
%p a := proc(n) local r, p;
%p if n <= 2 then return n fi;
%p if n::odd then
%p if isprime(n) then return n fi;
%p r := prevprime(n);
%p p := [seq(2, i=1..(n + 1 - r)/2), r]
%p else
%p r := prevprime(n - 1);
%p p := [n - r, r]
%p fi;
%p return mul(k, k in p)
%p end: seq(a(n), n = 0..61);
%o (SageMath)
%o def a(n):
%o if n <= 2: return n
%o if n % 2 == 1:
%o if is_prime(n): return n
%o r = previous_prime(n)
%o p = [r] + [2]*((n + 1 - r)//2)
%o else:
%o r = previous_prime(n - 1)
%o p = [r, n - r]
%o return mul(p)
%o print([a(n) for n in range(40)])
%K nonn
%O 0,3
%A _Peter Luschny_, Sep 08 2019
|