title: Sum Pairwise Products 2
signature: function sum_pairwise_products_2(n)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return abs(actual - expected) < 1e-09
  end
  
  function driver(n, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(n), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver(57, 1397887.0);
      @printf("TEST-0...%s\n",result);
      
      result = driver(18, 15675.0);
      @printf("TEST-1...%s\n",result);
      
      result = driver(97, 11449977.0);
      @printf("TEST-2...%s\n",result);
      
      result = driver(9, 1155.0);
      @printf("TEST-3...%s\n",result);
      
      result = driver(42, 420497.0);
      @printf("TEST-4...%s\n",result);
      
      result = driver(67, 2645897.0);
      @printf("TEST-5...%s\n",result);
      
      result = driver(71, 3327486.0);
      @printf("TEST-6...%s\n",result);
      
      result = driver(66, 2493271.0);
      @printf("TEST-7...%s\n",result);
      
      result = driver(69, 2972060.0);
      @printf("TEST-8...%s\n",result);
      
      result = driver(18, 15675.0);
      @printf("TEST-9...%s\n",result);
      
  end
  
  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;
  }