This is simply an implementation of Binet’s formula in C++; someone had a question regarding calculating Fibonacci numbers from the nth number, backwards, so I created this small program. It calculates Fibonacci numbers from the 50th, down to the 1st, in reverse. Python would allow for greater Fibonacci sequence calculations due to the arbitrary length of the numeric variables, as opposed to a constrained length in C++.
#include<iostream> #include<math.h> int main(void) { unsigned long long fibbBuff; for(int i = 50; i > 0; i--) { fibbBuff = ((1/sqrt(5)) * (pow((((1 + sqrt(5))/2)),i) - pow((((1 - sqrt(5))/2)),i))); std::cout << std::endl << fibbBuff; } return 0; }