title: Sum Matrix Element Absolute Difference Row Column Numbers 2
signature: function sumMatrixElementAbsoluteDifferenceRowColumnNumbers2(n) {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value) {
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual, expected){
      return convertToString(actual)===convertToString(expected);
  }
  
  function driver(n, expected){
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(12, 572);
    console.log(`TEST-0...${result}`);
  
    result = driver(89, 234960);
    console.log(`TEST-1...${result}`);
  
    result = driver(76, 146300);
    console.log(`TEST-2...${result}`);
  
    result = driver(2, 2);
    console.log(`TEST-3...${result}`);
  
    result = driver(81, 177120);
    console.log(`TEST-4...${result}`);
  
    result = driver(11, 440);
    console.log(`TEST-5...${result}`);
  
    result = driver(26, 5850);
    console.log(`TEST-6...${result}`);
  
    result = driver(35, 14280);
    console.log(`TEST-7...${result}`);
  
    result = driver(16, 1360);
    console.log(`TEST-8...${result}`);
  
    result = driver(66, 95810);
    console.log(`TEST-9...${result}`);
  
    process.exit(0);
  };
  
  if (require.main === module) {
    main();
  }
source_py: def sum_matrix_element_absolute_difference_row_column_numbers_2(n):
      n -= 1
      sum = 0
      sum += ((n * (n + 1)) / 2)
      sum += (((n * (n + 1)) * ((2 * n) + 1)) / 6)
      return int(sum)
source_cpp: int sum_matrix_element_absolute_difference_row_column_numbers_2(int n) {
    n --;
    int sum = 0;
    sum += ( n * ( n + 1 ) ) / 2;
    sum += ( n * ( n + 1 ) * ( 2 * n + 1 ) ) / 6;
    return sum;
  }