My Math Forum Reverse Fibonacci series.

 Computer Science Computer Science Forum

 March 9th, 2019, 10:24 AM #1 Banned Camp   Joined: Nov 2018 From: Mumbai Posts: 32 Thanks: 1 Reverse Fibonacci series. Reference : https://www.programiz.com/c-programm...bonacci-series Can we write a computer program which will print reverse Fibonacci series numbers starting from 100 till 0? The computer program could be in any programming language viz C,C++,Java,C#, Python etc. Thanks & Regards, Prashant S Akerkar Last edited by akerkarprash; March 9th, 2019 at 10:25 AM. Reason: Content updates
March 9th, 2019, 10:34 AM   #2
Math Team

Joined: May 2013
From: The Astral plane

Posts: 2,079
Thanks: 845

Math Focus: Wibbly wobbly timey-wimey stuff.
Quote:
 Originally Posted by akerkarprash Reference : https://www.programiz.com/c-programm...bonacci-series Can we write a computer program which will print reverse Fibonacci series numbers starting from 100 till 0? The computer program could be in any programming language viz C,C++,Java,C#, Python etc. Thanks & Regards, Prashant S Akerkar
Why are you asking these? Someone gave you a method of printing the numbers in a list backward in another thread. Are you actually asking about Fibonacci numbers rather than programming?

-Dan

 March 9th, 2019, 10:40 AM #3 Senior Member     Joined: Sep 2015 From: USA Posts: 2,373 Thanks: 1276 /* generate the Fibonacci series to a list or array */ a[1]=1;a[2]=1; for(i=3,i<=100,i++){ a[i]=[i-1]+a[i-2]; } /* read out the array backwards */ for (i=100,i>=1,i--) { printf("%d\n",a[i]); } That might be valid C (it's been decades) but it's better interpreted as pseudocode. Another method involves knowing $F_{100},~F_{99}$ ahead of time. Then you can do a[100]=$F_{100}$; a[99]=$F_{99}$; for (i=98,i>=1,i--){ a[i] = a[i+2]-a[i+1]; }
 March 9th, 2019, 10:41 AM #4 Global Moderator   Joined: Dec 2006 Posts: 20,373 Thanks: 2010 The number 100 isn't a Fibonacci number. It wasn't clear what was meant. However, individual Fibonacci numbers are easily calculated. Last edited by skipjack; March 9th, 2019 at 11:10 AM.
 March 9th, 2019, 10:44 AM #5 Banned Camp   Joined: Nov 2018 From: Mumbai Posts: 32 Thanks: 1 Thanks. https://www.programiz.com/c-programm...bonacci-series I want to trace the programming logic for printing the Fibonacci series in reverse order. Can we can term this new series as Reverse Fibonacci numbers series? Thanks & Regards, Prashant S Akerkar
 March 9th, 2019, 10:56 AM #6 Global Moderator   Joined: Dec 2006 Posts: 20,373 Thanks: 2010 Starting with which Fibonacci number? Fibonacci numbers can be quite large, so the languages you've mentioned might not be good choices.
 March 9th, 2019, 10:59 AM #7 Banned Camp   Joined: Nov 2018 From: Mumbai Posts: 32 Thanks: 1 Thanks. I feel we should start with 89 till 0 for printing Reverse Fibonacci numbers series. Next Fibonacci number after 89 is 144 which is greater than 100. Thanks & Regards, Prashant S Akerkar
 March 9th, 2019, 03:19 PM #8 Math Team   Joined: Oct 2011 From: Ottawa Ontario, Canada Posts: 14,124 Thanks: 1003 Ye olde UBasic again: u=89 v=55 DOWHILE v>0 PRINT u, w=u-v u=v v=w ENDDO Output: 89,55,34,21,13,8,5,3,2,1,1 Thanks from topsquark
March 9th, 2019, 05:38 PM   #9
Senior Member

Joined: Aug 2012

Posts: 2,204
Thanks: 647

Quote:
 Originally Posted by Denis Ye olde UBasic again: u=89
In order to find the right value of u you had to compute the Fibs forward. This is actually a harder and more interesting situation than the primes. How do you determine the largest Fib number less than some given value?

There turns out to be a closed-form expression for the n-th Fib, you could use that.

A Closed Form of the Fibonacci Sequence - Mathonline

 March 9th, 2019, 07:31 PM #10 Senior Member   Joined: Jun 2014 From: USA Posts: 493 Thanks: 36 If going back from 100, you could just write a sentence of the numbers as text... which I suppose is generally true of any finite initial segment written backwards. Calculating it isn’t hard either as noted above. So long as your calculation of an initial and each successive Fib. is one that can be done in a finite number of steps, and in this case it most certainly is, there is a formula for it.

 Tags fibonacci, program, reverse, series

 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post Loren Number Theory 2 March 20th, 2018 10:16 PM hfsierra Number Theory 1 April 24th, 2015 08:02 AM chuackl Elementary Math 2 May 28th, 2014 03:08 AM vdrn Number Theory 28 October 22nd, 2011 04:07 PM mikeleblanc666 Applied Math 1 February 10th, 2009 01:54 PM

 Contact - Home - Forums - Cryptocurrency Forum - Top