posted 13 years ago

I'm fairly new to java and I have this assignment to do? How would i go about doing this?

Implement a program which computes the following recurrence relation:

f(1) = 1; f(2) = 1; f(3) = 1; f(4) = 1; f(5) = 1;

f(n) = f( n - 1 ) + 3 * f( n - 5 ) for all n > 5

Display the results for n = 6, 7, 12, and 15

Implement a program which computes the following recurrence relation:

f(1) = 1; f(2) = 1; f(3) = 1; f(4) = 1; f(5) = 1;

f(n) = f( n - 1 ) + 3 * f( n - 5 ) for all n > 5

Display the results for n = 6, 7, 12, and 15

posted 13 years ago

But it may be that an iterative solution would be more computationally efficient?

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch

Getting someone to think and try something out is much more useful than just telling them the answer.

Mike Gershman

Ranch Hand

Posts: 1272

Mike Gershman

Ranch Hand

Posts: 1272