Hello, Everyone.
Also See : Re: Natural Number and Sum of Fibonacci Numbers.
1. So the question is " How many terms, least of terms, of Fibonacci Numbers, they add up to 2015 ?
2. Is it possible to correct the program function ?
Thanks in advance for your time and help.
Regards.
Message was edited by: Loi Le
Message was edited by: Loi Le
Message was edited by: Loi Le
Solved! Go to Solution.
I don't currently have the time to review your exiting program. This is how I would set up the problem:
1.) Define the sum (S) you are trying to find.
2.) Start a counter (n:=0).
2.) Find the largest Fibonacci number (f) that is <= S.
3.) Add 1 to your counter (n:=n+1)
4.) Define your new sum as S:=S-f.
5.) Loop through steps 2-4 until S=0
6.) Return your final counter value (n).
For S = 2015:
1597 + 377 + 34 + 5 + 2 = 2015, so your answer is 5 terms.
I don't currently have the time to review your exiting program. This is how I would set up the problem:
1.) Define the sum (S) you are trying to find.
2.) Start a counter (n:=0).
2.) Find the largest Fibonacci number (f) that is <= S.
3.) Add 1 to your counter (n:=n+1)
4.) Define your new sum as S:=S-f.
5.) Loop through steps 2-4 until S=0
6.) Return your final counter value (n).
For S = 2015:
1597 + 377 + 34 + 5 + 2 = 2015, so your answer is 5 terms.
Many thanks for your time and help, Mark.
Regards.