title: Sum Pairwise Products 2
signature: function sumPairwiseProducts2(n: number): number {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: number, expected: number): boolean {
      return Math.abs(actual - expected) < 1e-09;
  }
  
  function driver(n: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(57, 1397887.0);
    console.log(`TEST-0...${result}`);
  
    result = driver(18, 15675.0);
    console.log(`TEST-1...${result}`);
  
    result = driver(97, 11449977.0);
    console.log(`TEST-2...${result}`);
  
    result = driver(9, 1155.0);
    console.log(`TEST-3...${result}`);
  
    result = driver(42, 420497.0);
    console.log(`TEST-4...${result}`);
  
    result = driver(67, 2645897.0);
    console.log(`TEST-5...${result}`);
  
    result = driver(71, 3327486.0);
    console.log(`TEST-6...${result}`);
  
    result = driver(66, 2493271.0);
    console.log(`TEST-7...${result}`);
  
    result = driver(69, 2972060.0);
    console.log(`TEST-8...${result}`);
  
    result = driver(18, 15675.0);
    console.log(`TEST-9...${result}`);
  
  };
  
  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;
  }