MAT

Riddle #3

Finds the sum of all equal terms of the Fibonacci sequence bounded above by M (excluding).

Constraints

10 < M < 108

Example

The first even numbers of the Fibonacci sequence of M = 200 are:

2, 8, 34, 144

Therefore their sum is: 188

Your program

<?php
    
function main($M) {

  $return = 0;
  /* Write your function here */
  
  return $return;
}
  
$IN = (array) json_decode(base64_decode($argv[1]));
extract($IN);
echo main($M);
?>

Your input

{ 
  "M": 200 
}

Your output

-

Correct output

188

0 0 votes
Article Rating
Notifiche
Notificami
0 Comments
Inline Feedbacks
View all comments