title: Finding Power Prime Number P N 1
signature: func findingPowerPrimeNumberPN1(n int, p int) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(n int, p int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(n, p),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(76, 
  	43, 1)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(77, 
  	91, 0)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(9, 
  	42, 0)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(59, 
  	67, 0)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(8, 
  	52, 0)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(97, 
  	8, 13)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(78, 
  	24, 3)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(41, 
  	88, 0)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(72, 
  	61, 1)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(71, 
  	28, 2)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
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;
  }