A385707 Irregular triangle T(r,k) read by rows in which row r lists the partitions into distinct primes of the r-th number having such partitions, r >= 1, k >= 1.
2, 3, 5, 3, 2, 7, 5, 2, 5, 3, 7, 2, 7, 3, 5, 3, 2, 11, 7, 5, 7, 3, 2, 13, 11, 2, 11, 3, 7, 5, 2, 13, 2, 7, 5, 3, 13, 3, 11, 5, 11, 3, 2, 17, 7, 5, 3, 2, 13, 5, 13, 3, 2, 11, 7, 11, 5, 2, 19, 17, 2, 11, 5, 3, 17, 3, 13, 7, 13, 5, 2, 11, 7, 2, 19, 2, 13, 5, 3
Offset: 2
Examples
r n \ k 1 2 3 4 5 ----------------------------------- 1 2 [ 2]; 2 3 [ 3]; 3 5 [ 5], [3, 2]; 4 7 [ 7], [5, 2]; 5 8 [ 5, 3]; 6 9 [ 7, 2]; 7 10 [ 7, 3], [5, 3, 2]; 8 11 [11]; 9 12 [ 7, 5], [7, 3, 2]; ... For n = 10 we can see that 10 is the 7th number having partitions into distinct primes so the 7th row of the triangle lists the two partitions that are the two ways to write 10 as a sum of distinct primes: 7 + 3 and 5 + 3 + 2.
Programs
-
Python
from sympy.utilities.iterables import partitions from sympy import isprime res = [] for n in range(22): for p in partitions(n): for i, f in p.items(): if not isprime(i) or f>1: break else: res.extend(list(p.keys())) print(res)
Comments