Fibonacci sequence: Difference between revisions

Content deleted Content added
m →‎{{header|REXX}}: added whitespace to the output section header.
m →‎{{header|REXX}}: changed wording for the program's output.
Line 6,205: Line 6,205:
<lang rexx>/*REXX program calculates the Nth Fibonacci number, N can be zero or negative.*/
<lang rexx>/*REXX program calculates the Nth Fibonacci number, N can be zero or negative.*/
numeric digits 210000 /*be able to handle ginormous numbers. */
numeric digits 210000 /*be able to handle ginormous numbers. */
parse arg x y . /*allow a single number or a range. */
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 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).*/
if y=='' then y=x /*if only one number, display fib(n).*/
w=max(length(x), length(y)) /*W: used for making formatted output.*/
w=max(length(x), length(y)) /*W: used for making formatted output.*/
Line 6,214: Line 6,214:
fw=max(fw, L) /*fib number length, or the max so far.*/
fw=max(fw, L) /*fib number length, or the max so far.*/
say 'Fibonacci('right(j,w)") = " right(q,fw) /*right justify Q.*/
say 'Fibonacci('right(j,w)") = " right(q,fw) /*right justify Q.*/
if L>10 then say 'Fibonacci('right(j, w)") has a length of" L
if L>10 then say 'Fibonacci('right(j, w)") has a length of " L @
end /*j*/ /* [↑] list a Fib. sequence of x──►y */
end /*j*/ /* [↑] list a Fib. sequence of x──►y */
exit /*stick a fork in it, we're all done. */
exit /*stick a fork in it, we're all done. */
Line 6,316: Line 6,316:
452377767440619224033763867400402133034329749690202832814593341882681768389307200363479562311710310129195316979460763273758925353077255237594378843450406771555577905645044301664011946258097221672975861502696844314695203461493229110597067624326851599283470989128470674086200858713501626031207190317208609408129832158107728207635318662461127824553720853236530577595643007251774431505153960090516860322034916322264088524885243315805153484962243484829938090507048348244932745373262456775587908918719080366205800959474315005240253270974699531877072437682590741993963226598414749819360928522394503970716544
452377767440619224033763867400402133034329749690202832814593341882681768389307200363479562311710310129195316979460763273758925353077255237594378843450406771555577905645044301664011946258097221672975861502696844314695203461493229110597067624326851599283470989128470674086200858713501626031207190317208609408129832158107728207635318662461127824553720853236530577595643007251774431505153960090516860322034916322264088524885243315805153484962243484829938090507048348244932745373262456775587908918719080366205800959474315005240253270974699531877072437682590741993963226598414749819360928522394503970716544
3156421328157688908058783183404917434556270520223564846495196112460268313970975069382648706613264507665074611512677522748621598642530711298441182622661057163515069260029861704945425047491378115154139941550671256271197133252763631939606902895650288268608362241082050562430701794976171121233066073310059947366875
3156421328157688908058783183404917434556270520223564846495196112460268313970975069382648706613264507665074611512677522748621598642530711298441182622661057163515069260029861704945425047491378115154139941550671256271197133252763631939606902895650288268608362241082050562430701794976171121233066073310059947366875
Fibonacci(10000) has 2090 decimal digits.
Fibonacci(10000) has a length of 2090 decimal digits
</pre>
</pre>