Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In either Java or C# Instead of a regular Fibonacci number, you are supposed to calculate a special one as follows: F(n) = F(n-1)+ 2
In either Java or C#
Instead of a regular Fibonacci number, you are supposed to calculate a special one as follows:
F(n) = F(n-1)+ 2 * F(n-2) + 3 * F(n-3)
As an example, if F(0) = F(1) = F(2) = 1, then we have:
F(3) = F(2) + 2 * F(1) + 3 * F(0) = 1 + 2 + 3 = 6 F(4) = F(3) + 2 * F(2) + 3 * F(1) = 6 + 2 + 3 = 11
Given F(0), F(1), F(2), and N, your job is to calculate F(N).
Input Format
First number is F(0), second number is F(1), third number is F(2), and last number is N.
Example input: 1 1 1 4
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started