Advertisement
Overfinch

new

Jul 2nd, 2022
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.21 KB | None | 0 0
  1. <?php
  2.  
  3. function F_recursive($n){
  4.     static $K;
  5.     if($n<=1) {
  6.         return 1;
  7.     } elseif (!isset($K[$n]) || $K[$n] == 0) {
  8.         $K[$n]=F_recursive($n-1) + F_recursive($n-2);
  9.     }
  10.     return $K[$n];
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement