
Computer Science Computer Science Forum 
 LinkBack  Thread Tools  Display Modes 
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/cprogramm...bonacciseries 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,200 Thanks: 898 Math Focus: Wibbly wobbly timeywimey stuff.  Quote:
Dan  
March 9th, 2019, 10:40 AM  #3 
Senior Member Joined: Sep 2015 From: USA Posts: 2,459 Thanks: 1340 
/* generate the Fibonacci series to a list or array */ a[1]=1;a[2]=1; for(i=3,i<=100,i++){ a[i]=[i1]+a[i2]; } /* 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,747 Thanks: 2133 
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/cprogramm...bonacciseries 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,747 Thanks: 2133 
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,587 Thanks: 1038 
Ye olde UBasic again: u=89 v=55 DOWHILE v>0 PRINT u, w=uv u=v v=w ENDDO Output: 89,55,34,21,13,8,5,3,2,1,1 
March 9th, 2019, 05:38 PM  #9 
Senior Member Joined: Aug 2012 Posts: 2,323 Thanks: 715  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 closedform expression for the nth 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: 528 Thanks: 43 
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  

Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Fibonacci vs. prime series  Loren  Number Theory  2  March 20th, 2018 10:16 PM 
FibonacciType series and the number e  hfsierra  Number Theory  1  April 24th, 2015 08:02 AM 
fibonacci series  chuackl  Elementary Math  2  May 28th, 2014 03:08 AM 
reverse n  vdrn  Number Theory  28  October 22nd, 2011 04:07 PM 
What is the summation formula for fibonacci series?  mikeleblanc666  Applied Math  1  February 10th, 2009 01:54 PM 