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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Natural Number and Sum of Fibonacci Numbers (2).

lvl107
20-Turquoise

Natural Number and Sum of Fibonacci Numbers (2).

  Hello, Everyone.

(3).PNG

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

1 ACCEPTED SOLUTION

Accepted Solutions
MJG
18-Opal
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.

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.

View solution in original post

3 REPLIES 3
MJG
18-Opal
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.

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.

lvl107
20-Turquoise
(To:MJG)

  Many thanks for your time and help, Mark.

(5).PNG

     Regards.

lvl107
20-Turquoise
(To:lvl107)

(4).PNG

Top Tags