title: Sum Pairwise Products 2
signature: sum_pairwise_products_2 <- function(n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      abs(actual - expected) < 1e-09
  }
  
  driver <- function(n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          57L, 
          1397887.0
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          18L, 
          15675.0
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          97L, 
          11449977.0
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          9L, 
          1155.0
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          42L, 
          420497.0
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          67L, 
          2645897.0
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          71L, 
          3327486.0
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          66L, 
          2493271.0
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          69L, 
          2972060.0
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          18L, 
          15675.0
      )))
  
  }
  
  main()
source_py: def sum_pairwise_products_2(n):
      return ((((n * (n + 1)) * (n + 2)) * ((3 * n) + 1)) / 24)
source_cpp: long long int sum_pairwise_products_2(int n) {
    return n * ( n + 1 ) * ( n + 2 ) * ( 3 * n + 1 ) / 24;
  }