title: Sum Pairwise Products 1
signature: function sum_pairwise_products_1(n)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  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(41, 382571);
      @printf("TEST-0...%s\n",result);
      
      result = driver(50, 834275);
      @printf("TEST-1...%s\n",result);
      
      result = driver(67, 2645897);
      @printf("TEST-2...%s\n",result);
      
      result = driver(18, 15675);
      @printf("TEST-3...%s\n",result);
      
      result = driver(60, 1711355);
      @printf("TEST-4...%s\n",result);
      
      result = driver(6, 266);
      @printf("TEST-5...%s\n",result);
      
      result = driver(27, 74907);
      @printf("TEST-6...%s\n",result);
      
      result = driver(46, 601036);
      @printf("TEST-7...%s\n",result);
      
      result = driver(50, 834275);
      @printf("TEST-8...%s\n",result);
      
      result = driver(20, 23485);
      @printf("TEST-9...%s\n",result);
      
  end
  
  main()
source_py: def sum_pairwise_products_1(n):
      multiTerms = ((n * (n + 1)) // 2)
      sm = multiTerms
      for i in range(2, (n + 1)):
          multiTerms = (multiTerms - (i - 1))
          sm = (sm + (multiTerms * i))
      return sm
source_cpp: long long int sum_pairwise_products_1(int n) {
    long long int multiTerms = n * ( n + 1 ) / 2;
    long long int sum = multiTerms;
    for ( int i = 2;
    i <= n;
    i ++ ) {
      multiTerms = multiTerms - ( i - 1 );
      sum = sum + multiTerms * i;
    }
    return sum;
  }