title: N Th Number Whose Sum Of Digits Is Ten 2
signature: n_th_number_whose_sum_of_digits_is_ten_2 <- function(n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          68L, 
          631L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          70L, 
          649L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          69L, 
          640L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          93L, 
          856L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          99L, 
          910L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          44L, 
          415L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          91L, 
          838L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          8L, 
          82L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          83L, 
          766L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          51L, 
          478L
      )))
  
  }
  
  main()
source_py: def n_th_number_whose_sum_of_digits_is_ten_2(n):
      nthElement = (19 + ((n - 1) * 9))
      outliersCount = (int(math.log10(nthElement)) - 1)
      nthElement += (9 * outliersCount)
      return nthElement
source_cpp: int n_th_number_whose_sum_of_digits_is_ten_2(int n) {
    int nthElement = 19 + ( n - 1 ) * 9;
    int outliersCount = ( int ) log10 ( nthElement ) - 1;
    nthElement += 9 * outliersCount;
    return nthElement;
  }