title: Find Sum Modulo K First N Natural Number 1
signature: find_sum_modulo_k_first_n_natural_number_1 <- function(n, k) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(n, k, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n, k), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          40L, 90L, 
          2600L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          46L, 64L, 
          2530L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          97L, 20L, 
          1074L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          63L, 1L, 
          0L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          92L, 52L, 
          3166L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          60L, 35L, 
          1345L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          67L, 40L, 
          1684L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          61L, 62L, 
          3751L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          74L, 61L, 
          2311L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          67L, 41L, 
          1691L
      )))
  
  }
  
  main()
source_py: def find_sum_modulo_k_first_n_natural_number_1(N, K):
      ans = 0
      y = (N / K)
      x = (N % K)
      ans = ((((K * (K - 1)) / 2) * y) + ((x * (x + 1)) / 2))
      return int(ans)
source_cpp: int find_sum_modulo_k_first_n_natural_number_1(int N, int K) {
    int ans = 0;
    int y = N / K;
    int x = N % K;
    ans = ( K * ( K - 1 ) / 2 ) * y + ( x * ( x + 1 ) ) / 2;
    return ans;
  }