Given a positive integer n, check if it is an Ore number or not. Print ‘YES’ if n is an ore number otherwise print ‘NO’.
Ore Number : In mathematics, Ore numbers are positive integers whose divisors have a integer harmonic value. Ore numbers are often called as harmonic divisor number. Ore numbers are named after Øystein Ore.
For example, 6 has four divisors namely 1, 2, 3 and 6.
Harmonic mean of the divisors is-
The harmonic mean of divisors of 6 is 2, an integer. So, 6 is an Ore number or harmonic divisor number.
First few Ore numbers or harmonic divisor numbers are:
1, 6, 28, 140, 270, 496, 672, 1638, 2970, 6200, 8128, 8190
Input : N = 6 Output : Yes Input : N = 4 Output: No Explanation : Harmonic mean of divisors of 4 is not an Integer.
The idea is to generate all divisors of the given number and then check if the harmonic mean of the divisor is an Integer or not.
- Generate All Divisors of the given number – ‘n’
- Calculate Harmonic mean of the divisors of n
- Check if Harmonic mean is an Integer or not
- If Yes, Then the number is an Ore Number otherwise Not
Below is the implementation of above approach:
- Check whether all the rotations of a given number is greater than or equal to the given number or not
- Check if a number is divisible by all prime divisors of another number
- Program to check whether a number is Proth number or not
- Check if a number with even number of digits is palindrome or not
- Check whether the given number is Euclid Number or not
- Check if a number is an Achilles number or not
- Check if a number is a Mystery Number
- Check if a number is Triperfect Number
- Check if a number is a Trojan Number
- Check if a number is a power of another number
- Check if given number is Emirp Number or not
- Check Whether a number is Duck Number or not
- Check if a number is an Unusual Number or not
- Check if a number is Flavius Number
- Check if a number is a Krishnamurthy Number or not
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 Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.