<?php $digit = 1; $answer = 2; $next = array(); $f1 = array(1=>1); $f2 = array(1=>1); while($digit < 1000) { $next = array(); $answer++; $count = count($f2); for($i = 1 ; $i <= $count ; $i++) { @$next[$i] = $next[$i] + $f1[$i] + $f2[$i]; if($next[$i] >= 10) { @$next[$i + 1]++; $next[$i] -= 10; } } $f1 = $f2; $f2 = $next; $digit = count($next); } echo $answer; ?>