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
- Number which has the maximum number of distinct prime factors in the range M to N
- 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
- Given number of matches played, find number of teams in tournament
- Represent a number as a sum of maximum possible number of Prime Numbers
- Check if a number is divisible by all prime divisors of another number
- Check whether all the rotations of a given number is greater than or equal to the given number or not
- Count Number of animals in a zoo from given number of head and legs
- Count number of digits after decimal on dividing a number
- Program to Convert Octal Number to Binary Number
- Build Lowest Number by Removing n digits from a given number
Improved By : jit_t