I conceived it myself, and actually the program to solve this thing is an offset problem. First look at the sequence:: 1, 1, 2, 3, 5, 8, 13, 21, 34, the next number of series is the sum of the first 2 digits, and so on.
The program is actually a for statement, the traditional for statement is for ($i =1; $i; $count, $i + +), where the offset is $i= $i +1. If this sequence is processed, the offset is not 1, the first 1 digits. So when you're for, a variable records the previous number, the other record is the current number, the offset is the number, and then the loop is assigned a value, and the last number is recorded as an ex-loop value, which is the offset of the next loop. The code is actually simple:
Copy Code code as follows:
$count = 9999999999967543;
$array = Array (' 0′=>1);
For ($a =1, $i =2; $i < $count; $i = $i + $a) {
$array [] = $a;
$array [] = $i;
$a = $a + $i;
}
Print_r ($array);
echo $count. '. Count ($array). ' The number of Fibonacci sequences ';
Suggest which boring person take this to Phpchina to the Chinese cabbage profession top Pastes