how to generate the nth fibonacci number?
Hi @skyzvoir0001
H
Names Default To Here( 1 );
// declare the ith item you are looking for
FibN = 10;
New Table( "Fibonacci", // private,
Add Rows( fibN ),
New Column( "Fib",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( If( Row() == 1, 0, Row() == 2, 1, Lag( :Fib, 1 ) + Lag( :Fib, 2 ) ) ),
Set Selected
)
);
wait (.01);
nthfib = Col Max( :fib );
close ("Fibonacci", NoSave);
show (nthfib);
ave a look at this script. it many not be the sleekest but you can control it very easily.
It creates a table with a column containing the Fibonacci series and extracts the last value.
Let us know if it works for you.
Your request is vague. I think that @ron_horne provided a good solution if you want to make a JMP data table with the Fibonacci sequence. If instead you want to calculate a particular value in the sequence, then use Method 2 shown in this answer. It is not clear if you want to make a column formula, create a user function, or add the calculation to a script for this purpose.
Using @markbailey link, here is the simple script to get the value of a given sequence step
seq=6;
floor((1.618034^seq-(1-1.618034)^seq)/sqrt(5));