title: Sum Pairwise Products 2
signature: def sumPairwiseProducts2(n: Int) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Double , expected: Double): Boolean = {
      (actual - expected).abs < 1e-09
  }
  
  def driver(n: Int, expected: Double): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        57, 
        1397887.0    
      )}")   
  
  
      println(s"TEST-1...${driver(
        18, 
        15675.0    
      )}")   
  
  
      println(s"TEST-2...${driver(
        97, 
        11449977.0    
      )}")   
  
  
      println(s"TEST-3...${driver(
        9, 
        1155.0    
      )}")   
  
  
      println(s"TEST-4...${driver(
        42, 
        420497.0    
      )}")   
  
  
      println(s"TEST-5...${driver(
        67, 
        2645897.0    
      )}")   
  
  
      println(s"TEST-6...${driver(
        71, 
        3327486.0    
      )}")   
  
  
      println(s"TEST-7...${driver(
        66, 
        2493271.0    
      )}")   
  
  
      println(s"TEST-8...${driver(
        69, 
        2972060.0    
      )}")   
  
  
      println(s"TEST-9...${driver(
        18, 
        15675.0    
      )}")   
  
  }
  
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;
  }