Possible Duplicate:
A number as it’s prime number parts
I have this homework assignment of mine, hard as hell, where I have to get all the distinct prime partitions of a given number. For example, number 7 has five different prime partitions (or five different ways of representing the 2 prime partitions it has):
- 5 + 2
- 2 + 5
- 3 + 2 + 2
- 2 + 3 + 2
- 2 + 2 + 3
As you can see, the number itself is excluded in the case it's a prime. I don't have to print all the distinct partitions, only the number of them.
So I'm a bit lost with this. I've been completely unable to produce any code, but I think I should approach this from a dynamic programming kind of view. I'm only asking for some hints. Has anyone got an idea? Thanks in advance.
The highest inputted number is 100. Also, the running time of the program cannot exceed 1 second, and the memory limit is 128 MB.