title: Sequences Given Length Every Element Equal Twice Previous
signature: sequences_given_length_every_element_equal_twice_previous <- function(m, n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(m, n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(m, n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          38L, 34L, 
          0L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          39L, 29L, 
          0L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          24L, 99L, 
          0L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          90L, 23L, 
          0L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          44L, 2L, 
          484L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          49L, 70L, 
          0L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          58L, 84L, 
          0L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          97L, 34L, 
          0L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          99L, 72L, 
          0L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          19L, 67L, 
          0L
      )))
  
  }
  
  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 );
  }