title: Sum K Th Group Odd Positive Numbers
signature: sum_k_th_group_odd_positive_numbers <- function(k) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(k, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(k), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          91L, 
          753571L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          52L, 
          140608L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          78L, 
          474552L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          51L, 
          132651L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          65L, 
          274625L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          39L, 
          59319L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          42L, 
          74088L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          12L, 
          1728L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          56L, 
          175616L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          98L, 
          941192L
      )))
  
  }
  
  main()
source_py: def sum_k_th_group_odd_positive_numbers(k):
      cur = int(((k * (k - 1)) + 1))
      sum = 0
      while k:
          sum += cur
          cur += 2
          k = (k - 1)
      return sum
source_cpp: int sum_k_th_group_odd_positive_numbers(int k) {
    int cur = ( k * ( k - 1 ) ) + 1;
    int sum = 0;
    while ( k -- ) {
      sum += cur;
      cur += 2;
    }
    return sum;
  }