• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Fibonacci code doesn't work

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, good day, in the tutorial I saw it says that the "algebraic" formula (I don't know if the term is correct, if it isn't, please correct me) is the one in the image.
Now, I try it in pencil and I GET AN ERROR, FOR EJ:
(8-1) + (8-2) This gives 7+6=13.  OK.
But with 13  WRONG:
(13-1) + (13-2)
  12+11=23.
DOES ANYONE KNOW WHY? Thanks
FORMULAFIBONACCI.png
[Thumbnail for FORMULAFIBONACCI.png]
 
Sheriff
Posts: 4643
582
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The next number in the sequence is calculated by adding the two numbers that proceed it, not the specific values 1 and 2.  

It appears that in the tutorial, № -1 represents the value one position to the left and № -2 represents the value two positions to the left : La sucesión comienza con los números 0 y 1, y a partir de estos cada término es la suma de los dos anteriores.

For example:
 
Marshal
Posts: 5659
330
IntelliJ IDE Python TypeScript Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The typesetting is unfortunate. I think this is what they meant.

xn = xn−1 + xn−2
 
And inside of my fortune cookie was this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic