Randall, recursion becomes much easier if your code is self-documenting. I wouldn't call recurse() a particularly descriptive method name. What problem does it solve?
What if you have a method
int waysToWrite(int number, int limit)? It will determine in how many ways you can write number, with none of the terms of the sums exceeding limit. Let's take 7 as an example:
7
6 1
5 2
5 1 1
4 3
4 2 1
4 1 1 1
3 3 1
3 2 2
3 2 1 1
3 1 1 1 1
2 2 2 1
2 2 1 1 1
2 1 1 1 1 1
1 1 1 1 1 1 1
That gives the following number of ways to write 7, you just need to add them together:
7: 1
6: waysToWrite(1,6)
5: waysToWrite(2,5)
4: waysToWrite(3,4)
3: waysToWrite(4,3)
2: waysToWrite(5,2)
1: waysToWrite(6,1)
My implementation of
waysToWrite() didn't use dynamic programming, and took about 10 seconds to come up with the answer for
waysToWrite(100, 99). You can add a HashMap that stores answers you already computed in a previous run, which will probably cause the program to come up with the final answer instantaneously.