Fibonacci Series is a series of numbers in which each number (Fibonacci number) is the sum of the two preceding numbers. The simplest is the series 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144 etc.
As seems that, the first two numbers in this sequence are either 1 and 1 or 0 and 1 depending on the chosen starting point of the sequence and each subsequent number is the sum of the previous two.
In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation:
Fn = Fn-1 + Fn-2
with seed values
F0 = 0 and F1 = 1.
If you want to print the fibonacci number for 10th then it will be 55.
Code for PHP:
if ($n <= 1)
return fib($n – 1) +
fib($n – 2);
$n = 10;
In case, if you want to print the whole Fibonacci series in PHP then the code is:
echo “<p>ID: “.$j.”<br />Value: “.$numbers[$j].”</p>”;
Step by step hacking tutorials about wireless cracking, kali linux, metasploit, ethical hacking, seo tips and tricks, malware analysis and scanning.