ORE Number JavaThe 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: Number=6 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 numberIn 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. ORENumber.java Output: FindAllORENumbers.java Output: Next TopicPalPrime Number Java |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India