+0

# A partition of a positive integer n is any way of writing as a sum of one or more positive integers, in which we don't care about the

0
655
2

A partition of a positive integer n is any way of writing  as a sum of one or more positive integers, in which we don't care about the order of the numbers in the sum.

For example, the number 4 can be written as a sum of one or more positive integers (where we don't care about the order of the numbers in the sum) in exactly five ways:

\[4,\; 3 + 1,\; 2 + 2,\; 2 + 1 + 1,\; 1 + 1 + 1 + 1.\]
So 4 has five partitions.

What is the number of partitions of the number 7?

Feb 4, 2019

#1
0

Partitions of (7) =15 as follows:
7 = 7
6 + 1 = 7
5 + 2 = 7
5 + 1 + 1 = 7
4 + 3 = 7
4 + 2 + 1 = 7
4 + 1 + 1 + 1 = 7
3 + 3 + 1 = 7
3 + 2 + 2 = 7
3 + 2 + 1 + 1 = 7
3 + 1 + 1 + 1 + 1 = 7
2 + 2 + 2 + 1 = 7
2 + 2 + 1 + 1 + 1 = 7
2 + 1 + 1 + 1 + 1 + 1 = 7
1 + 1 + 1 + 1 + 1 + 1 + 1 = 7

Feb 4, 2019
#2
+1

I ran this Python code with GCC 4.8.2 on Linux:

from sympy.ntheory import npartitions

for i in range(1,100): print(npartitions(i))

Output:

1
2
3
5
7
11
15
22
30
42
56
77
101
135
176
231
297
385
490
627
792
1002
1255
1575
1958
2436
3010
3718
4565
5604
6842
8349
10143
12310
14883
17977
21637
26015
31185
37338
44583
53174
63261
75175
89134
105558
124754
147273
173525
204226
239943
281589
329931
386155
451276
526823
614154
715220
831820
966467
1121505
1300156
1505499
1741630
2012558
2323520
2679689
3087735
3554345
4087968
4697205
5392783
6185689
7089500
8118264
9289091
10619863
12132164
13848650
15796476
18004327
20506255
23338469
26543660
30167357
34262962
38887673
44108109
49995925
56634173
64112359
72533807
82010177
92669720
104651419
118114304
133230930
150198136
169229875

The 7th row is 15. So the answer is 15 :P

Feb 7, 2019