title: Sequences Given Length Every Element Equal Twice Previous
signature: function sequences_given_length_every_element_equal_twice_previous(m, n)
test_code: 
  
  -- SOLUTION CODE
  -- ============================================
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  function isCorrect(actual, expected)
      if type(expected) ~= type(actual) then
          return false
      end
      
      if type(expected) == 'table' then
          for k,v_expected in pairs(expected) do
              
              if actual[k] == nil then
                  return false
              end
              local v_actual = actual[k]
              if not isCorrect(v_actual, v_expected) then
                  return false
              end
              actual[k]=nil
          end
      
          if next(actual) then 
              return false
          end
          return true
      else
          return actual == expected
      end
  end
  
  function validateSolution(actual, expected)
      return isCorrect(actual,expected)
  end
  
  function driver(m, n, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(m, n) 
      end)
      if status then
          if validateSolution(exec_result,expected) then
              return "PASSED"
          end
          return "FAILED"
      else
          return string.format("ERROR=%s",string.gsub(error_msg,".*:[%d]+: ",""))
      end
  end
      
  function main()
      result = driver(38, 34, 0)
      print(string.format("TEST-0...%s",result))
  
      result = driver(39, 29, 0)
      print(string.format("TEST-1...%s",result))
  
      result = driver(24, 99, 0)
      print(string.format("TEST-2...%s",result))
  
      result = driver(90, 23, 0)
      print(string.format("TEST-3...%s",result))
  
      result = driver(44, 2, 484)
      print(string.format("TEST-4...%s",result))
  
      result = driver(49, 70, 0)
      print(string.format("TEST-5...%s",result))
  
      result = driver(58, 84, 0)
      print(string.format("TEST-6...%s",result))
  
      result = driver(97, 34, 0)
      print(string.format("TEST-7...%s",result))
  
      result = driver(99, 72, 0)
      print(string.format("TEST-8...%s",result))
  
      result = driver(19, 67, 0)
      print(string.format("TEST-9...%s",result))
  
  end
  
  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 );
  }