Derive a formula for the number of partitions of n into parts that are odd and bigger than 1; e.g. a(12)=5 cases: 3+3+3+3, 5+7, 7+5, 3+9, 9+3.
Verify your formula by evaluating a(14).
DECLARE SUB decompose (x!)
CLEAR , , 25000
DIM SHARED ct
CLS
FOR n = 1 TO 44
ct = 0
decompose n
PRINT n, ct
NEXT n
SUB decompose (x)
IF x < 3 THEN EXIT SUB
FOR addend = 3 TO x STEP 2
IF addend = x THEN
ct = ct + 1
ELSE
decompose x - addend
END IF
NEXT
END SUB
finds
n partitions
1 0
2 0
3 1
4 0
5 1
6 1
7 1
8 2
9 2
10 3
11 4
12 5
13 7
14 9
15 12
16 16
17 21
18 28
19 37
20 49
21 65
22 86
23 114
24 151
25 200
26 265
27 351
28 465
29 616
30 816
31 1081
32 1432
33 1897
34 2513
35 3329
36 4410
37 5842
38 7739
39 10252
40 13581
41 17991
42 23833
43 31572
44 41824
|
Posted by Charlie
on 2013-01-24 13:55:44 |