title: Sum Pairwise Products 2
signature: func sumPairwiseProducts2(n int) float64 {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual float64, expected float64) bool {
      return math.Abs(actual - expected) < 1e-09
  }
  
  func driver(n int, expected float64) string {
      if validateSolution(PLACEHOLDER_FN_NAME(n),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(57, 1397887.0)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(18, 15675.0)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(97, 11449977.0)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(9, 1155.0)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(42, 420497.0)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(67, 2645897.0)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(71, 3327486.0)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(66, 2493271.0)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(69, 2972060.0)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(18, 15675.0)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
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;
  }