Fibonacci sequence: Difference between revisions

Content deleted Content added
m →‎{{header|REXX}}: changed wording for the program's output.
m →‎{{header|REXX}}: used simpler/shorter statements
Line 6,200:
=={{header|REXX}}==
With   210,000   numeric decimal digits, this REXX program can handle Fibonacci numbers past one million.
<br>[Generally speaking, some REXX interpreters can handle up to around 8eight million decimal digits.]
 
This version of the REXX program can also handle &nbsp; ''negative'' &nbsp; Fibonacci numbers.
<lang rexx>/*REXX program calculates the Nth Fibonacci number, N can be zero or negative.*/
numeric digits 210000 /*be able to handle ginormous numbers. */
parse arg x y .; @=' decimal digits' /*allow a single number or a range. */
if x=='' then do; x=-40; y=+40; end /*No input? Then use range -40 ──► +40*/
if y=='' then y=x /*if only one number, display fib(n).*/
Line 6,214:
fw=max(fw, L) /*fib number length, or the max so far.*/
say 'Fibonacci('right(j,w)") = " right(q,fw) /*right justify Q.*/
if L>10<=11 then sayiterate 'Fibonacci('right(j, w)") has a length of " /*smallish L#, so don't show number @len.*/
say 'Fibonacci('right(j, w)") has a length of " L ' decimal digits'
end /*j*/ /* [↑] list a Fib. sequence of x──►y */
exit /*stick a fork in it, we're all done. */