- #1

- 2

- 0

This program have to calculate the numbers of partitions of a number using the euler formula

So, here is the program i have done, i don't know where is the mistakes, and I would greatly appreciate to help me.

http://mathworld.wolfram.com/PartitionFunctionP.html#eqn11

So, here is the program i have done, i don't know where is the mistakes, and I would greatly appreciate to help me.

http://mathworld.wolfram.com/PartitionFunctionP.html#eqn11

Code:

```
function fn = euler(n)
if n == 0
fn = 1;
return
else
for i = 1 : 1 : n
fn = ((-1)^ (i + 1)) * euler(n - i * (3 * i - 1) / 2 ) + euler(n - i * (3 * i + 1 ) / 2);
return
end
end
end
```

Last edited by a moderator: