title: Sum Pairwise Products 2
signature: fun sumPairwiseProducts2(n: Int): Double {
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;
  }
question_info.test_list: [{"idx": 0, "outputs": 1397887.0, "inputs": {"n": 57}}, {"idx": 1, "outputs": 15675.0, "inputs": {"n": 18}}, {"idx": 2, "outputs": 11449977.0, "inputs": {"n": 97}}, {"idx": 3, "outputs": 1155.0, "inputs": {"n": 9}}, {"idx": 4, "outputs": 420497.0, "inputs": {"n": 42}}, {"idx": 5, "outputs": 2645897.0, "inputs": {"n": 67}}, {"idx": 6, "outputs": 3327486.0, "inputs": {"n": 71}}, {"idx": 7, "outputs": 2493271.0, "inputs": {"n": 66}}, {"idx": 8, "outputs": 2972060.0, "inputs": {"n": 69}}, {"idx": 9, "outputs": 15675.0, "inputs": {"n": 18}}]
question_info.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Double, expected:Double):Boolean{
    return abs(actual - expected) < 1e-09
  }
  fun driver(n: Int, expected:Double):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(57, 1397887.0)
      println("TEST-0...${result}")
      
      result = driver(18, 15675.0)
      println("TEST-1...${result}")
      
      result = driver(97, 11449977.0)
      println("TEST-2...${result}")
      
      result = driver(9, 1155.0)
      println("TEST-3...${result}")
      
      result = driver(42, 420497.0)
      println("TEST-4...${result}")
      
      result = driver(67, 2645897.0)
      println("TEST-5...${result}")
      
      result = driver(71, 3327486.0)
      println("TEST-6...${result}")
      
      result = driver(66, 2493271.0)
      println("TEST-7...${result}")
      
      result = driver(69, 2972060.0)
      println("TEST-8...${result}")
      
      result = driver(18, 15675.0)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: sumPairwiseProducts2
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn