Given two integers K and N, the task is to find the count of integers from the range [2, N – 1] whose sum of prime divisors is K
Input: N = 20, K = 7
7 and 10 are the only valid numbers.
sumPFactors(7) = 7
sumPFactors(10) = 2 + 5 = 7
Input: N = 25, K = 5
Approach: Create an array sumPF where sumPF[i] stores the sum of prime divisors of i which can be easily calculated using the approach used in this article. Now, initialise a variable count = 0 and run a loop from 2 to N – 1 and for every element i if sumPF[i] = K then increment the count.
Below is the implementation of the above approach:
- Numbers in range [L, R] such that the count of their divisors is both even and prime
- Sum of all prime divisors of all the numbers in range L-R
- Count the numbers < N which have equal number of divisors as K
- Program to find count of numbers having odd number of divisors in given range
- Find count of Almost Prime numbers from 1 to N
- Count common prime factors of two numbers
- Count numbers from range whose prime factors are only 2 and 3
- Count all the numbers less than 10^6 whose minimum prime factor is N
- Queries for the difference between the count of composite and prime numbers in a given range
- Count numbers in a range having GCD of powers of prime factors equal to 1
- Count Numbers in Range with difference between Sum of digits at even and odd positions as Prime
- Count of distinct sums that can be obtained by adding prime numbers from given arrays
- Absolute difference between the Product of Non-Prime numbers and Prime numbers of an Array
- Sum of all the prime divisors of a number
- Absolute Difference between the Sum of Non-Prime numbers and Prime numbers of an Array
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.