ORE Number Java
The ORE number is a special positive number which is also known as a harmonic divisor number. A number is said to be ORE if its divisors have a harmonic value as an integer. Unlike Prime and Armstrong numbers, the ORE number is rarely asked by the interviewers.
Let's take some examples of ORE numbers.
Let's understand how we can calculate the harmonic mean of the number mathematically:
Factors of number 6=1,2,3,and 6
Harmonic mean = n / (∑1/xi)
Here, n is the number of factors, and x is the value of the factor. So,
The harmonic mean of the number 6 is 2, i.e., a positive integer value, so it is an ORE number.
Steps to check ORE number
In order to check whether the number is ORE or not, we have to follow the following steps:
Note: In order to find the harmonic mean of the number, we have to implement our own logic. There is no predefined function to get the harmonic mean of the number.
Let's implement the code to check whether the number is an ORE number or not.