Given a number, determine whether it is a valid Hyperperfect Number.
A number n is called k-hyperperfect if: n = 1 + k ∑idi where all di are the proper divisors of n.
Taking k = 1 will give us perfect numbers.
The first few k-hyperperfect numbers are 6, 21, 28, 301, 325, 496, 697, … with the corresponding values of k being 1, 2, 1, 6, 3, 1, 12, …
Input : N = 36, K = 1 Output : 34 is not 1-HyperPerfect Explanation: The Divisors of 36 are 2, 3, 4, 6, 9, 12, 18 the sum of the divisors is 54. For N = 36 to be 1-Hyperperfect, it would require 36 = 1 + 1(54), which we see, is invalid Input : N = 325, K = 3 Output : 325 is 3-HyperPerfect Explanation: We can use the first condition to evaluate this as K is odd and > 1 so here p = (3*k+1)/2 = 5, q = (3*k+4) = 13 p and q are both prime, so we compute p^2 * q = 5 ^ 2 * 13 = 325 Hence N is a valid HyperPerfect number
1570153 is 12-HyperPerfect 321 is not 3-HyperPerfect
Given k, we can perform a few checks in special cases to determine whether the number is hyperperfect:
- If K > 1 and K is odd , then let p = (3*k+1)/2 and q = 3*k+4 . If p and q are prime, then p2q is k-hyperperfect
- If p and q are distinct odd primes such that K(p + q ) = pq – 1 for some positive integral value of K, then pq is k-hyperperfect
This article is contributed by Deepak Srivatsav. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Determine the number of squares of unit area that a given line will pass through.
- Count number of triplets with product equal to given number with duplicates allowed
- Count number of trailing zeros in Binary representation of a number using Bitset
- Find minimum number to be divided to make a number a perfect square
- Given number of matches played, find number of teams in tournament
- Number which has the maximum number of distinct prime factors in the range M to N
- Find the number of positive integers less than or equal to N that have an odd number of digits
- Number of ways to split a binary number such that every part is divisible by 2
- Smallest number dividing minimum number of elements in the array | Set 2
- Smallest number dividing minimum number of elements in the Array
- Largest number dividing maximum number of elements in the array
- Number of times the largest perfect square number can be subtracted from N
- Number of possible permutations when absolute difference between number of elements to the right and left are given
- Check if a number is divisible by all prime divisors of another number
- Number of times a number can be replaced by the sum of its digits until it only contains one digit
Improved By : jit_t