title: Sum Pairwise Products 2
signature: function sumPairwiseProducts2($n) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return abs($actual - $expected) < 1e-09;
  }
  
  function driver($n, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($n), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        57, 
        1397887.0));
      
      printf("TEST-1...%s\n",driver(
        18, 
        15675.0));
      
      printf("TEST-2...%s\n",driver(
        97, 
        11449977.0));
      
      printf("TEST-3...%s\n",driver(
        9, 
        1155.0));
      
      printf("TEST-4...%s\n",driver(
        42, 
        420497.0));
      
      printf("TEST-5...%s\n",driver(
        67, 
        2645897.0));
      
      printf("TEST-6...%s\n",driver(
        71, 
        3327486.0));
      
      printf("TEST-7...%s\n",driver(
        66, 
        2493271.0));
      
      printf("TEST-8...%s\n",driver(
        69, 
        2972060.0));
      
      printf("TEST-9...%s\n",driver(
        18, 
        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;
  }