title: Finding Power Prime Number P N
signature: class Solution {
  
      public Double findingPowerPrimeNumberPN(Integer n, Integer p) {
source_py: def finding_power_prime_number_p_n(n, p):
      ans = 0
      temp = p
      while (temp <= n):
          ans += (n / temp)
          temp = (temp * p)
      return ans
source_cpp: int finding_power_prime_number_p_n(int n, int p) {
    int ans = 0;
    int temp = p;
    while ( temp <= n ) {
      ans += n / temp;
      temp = temp * p;
    }
    return ans;
  }
question_info.extension: java
question_info.entry_fn_name: findingPowerPrimeNumberPN
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 1.6333333333333333, "inputs": {"n": 49, "p": 30}}, {"idx": 1, "outputs": 3.2, "inputs": {"n": 80, "p": 25}}, {"idx": 2, "outputs": 1.1111111111111112, "inputs": {"n": 10, "p": 9}}, {"idx": 3, "outputs": 1.4210526315789473, "inputs": {"n": 81, "p": 57}}, {"idx": 4, "outputs": 2.75, "inputs": {"n": 11, "p": 4}}, {"idx": 5, "outputs": 1.3235294117647058, "inputs": {"n": 45, "p": 34}}, {"idx": 6, "outputs": 0, "inputs": {"n": 86, "p": 90}}, {"idx": 7, "outputs": 0, "inputs": {"n": 27, "p": 78}}, {"idx": 8, "outputs": 1.3333333333333333, "inputs": {"n": 80, "p": 60}}, {"idx": 9, "outputs": 3.129032258064516, "inputs": {"n": 97, "p": 31}}]
question_info.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer n, Integer p, Double expected){
          try{
              Driver driver = new Driver();
              if (driver.run(n, p,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(49, 30, 1.6333333333333333);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(80, 25, 3.2);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(10, 9, 1.1111111111111112);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(81, 57, 1.4210526315789473);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(11, 4, 2.75);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(45, 34, 1.3235294117647058);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(86, 90, 0.0);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(27, 78, 0.0);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(80, 60, 1.3333333333333333);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(97, 31, 3.129032258064516);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Integer p, Double expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n, p),expected);
      }
      
      public boolean validateSolution(Double actual, Double expected){
          return Math.abs(actual - expected) < 1e-09;
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: java __FILENAME__