Skip to main content
20-Turquoise
December 6, 2015
Solved

Natural Number and Sum of Fibonacci Numbers (2).

  • December 6, 2015
  • 2 replies
  • 1767 views

  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

Best answer by MJG

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.

2 replies

MJG1-VisitorAnswer
1-Visitor
December 9, 2015

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.

lvl10720-TurquoiseAuthor
20-Turquoise
December 10, 2015

  Many thanks for your time and help, Mark.

(5).PNG

     Regards.

lvl10720-TurquoiseAuthor
20-Turquoise
December 12, 2015

(4).PNG