title: Finding Power Prime Number P N 1
signature: finding_power_prime_number_p_n_1 <- function(n, p) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(n, p, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n, p), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          76L, 43L, 
          1L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          77L, 91L, 
          0L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          9L, 42L, 
          0L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          59L, 67L, 
          0L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          8L, 52L, 
          0L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          97L, 8L, 
          13L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          78L, 24L, 
          3L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          41L, 88L, 
          0L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          72L, 61L, 
          1L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          71L, 28L, 
          2L
      )))
  
  }
  
  main()
source_py: def finding_power_prime_number_p_n_1(n, p):
      ans = 0
      temp = p
      while (temp <= n):
          ans += (n / temp)
          temp = (temp * p)
      return int(ans)
source_cpp: int finding_power_prime_number_p_n_1(int n, int p) {
    int ans = 0;
    int temp = p;
    while ( temp <= n ) {
      ans += n / temp;
      temp = temp * p;
    }
    return ans;
  }