title: Sequences Given Length Every Element Equal Twice Previous
signature: function sequencesGivenLengthEveryElementEqualTwicePrevious($m, $n) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($m, $n, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($m, $n), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        38, 34, 
        0));
      
      printf("TEST-1...%s\n",driver(
        39, 29, 
        0));
      
      printf("TEST-2...%s\n",driver(
        24, 99, 
        0));
      
      printf("TEST-3...%s\n",driver(
        90, 23, 
        0));
      
      printf("TEST-4...%s\n",driver(
        44, 2, 
        484));
      
      printf("TEST-5...%s\n",driver(
        49, 70, 
        0));
      
      printf("TEST-6...%s\n",driver(
        58, 84, 
        0));
      
      printf("TEST-7...%s\n",driver(
        97, 34, 
        0));
      
      printf("TEST-8...%s\n",driver(
        99, 72, 
        0));
      
      printf("TEST-9...%s\n",driver(
        19, 67, 
        0));
      
  }
  
  main();
  ?>
source_py: def sequences_given_length_every_element_equal_twice_previous(m, n):
      if (m < n):
          return 0
      if (n == 0):
          return 1
      res = (sequences_given_length_every_element_equal_twice_previous((m - 1), n) + sequences_given_length_every_element_equal_twice_previous((m // 2), (n - 1)))
      return res
source_cpp: int sequences_given_length_every_element_equal_twice_previous(int m, int n) {
    if ( m < n ) return 0;
    if ( n == 0 ) return 1;
    return sequences_given_length_every_element_equal_twice_previous ( m - 1, n ) + sequences_given_length_every_element_equal_twice_previous ( m / 2, n - 1 );
  }