"Fibonacci Sequence IV"
Given the first few Fibonacci numbers:
How many digits are contained in the 1000th Fibonacci number?
Modify the loop from challenge 14 and this will be the easiest yet!
Awnser:
209
Source:
function solution(){
$prevno = 1; // no 1
$currno = 1; // no 2
for( $i = 1; $i < 1000; $i++ ){
$placeholder = bcadd($prevno, $currno);
$prevno = $currno;
$currno = $placeholder;
}
echo "".strlen($currno)."";
}