cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

## Natural Number and Sum of Fibonacci Numbers (2).  19-Tanzanite

## Natural Number and Sum of Fibonacci Numbers (2).

Hello, Everyone. 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 ?

Regards.

Message was edited by: Loi Le

Message was edited by: Loi Le

Message was edited by: Loi Le

1 ACCEPTED SOLUTION

Accepted Solutions  18-Opal
(To:lvl107)

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.

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.

3 REPLIES 3  18-Opal
(To:lvl107)

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.

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.  19-Tanzanite
(To:MJG)

Many thanks for your time and help, Mark.  Regards.  19-Tanzanite
(To:lvl107)  