Given an integer N, check whether the given number is a Moran Number or not. Moran numbers are a subset of Harshad numbers.
A number N is a Moran number if N divided by the sum of its digits gives a prime number. For example some Moran numbers are 18, 21, 27, 42, 45 and so on.
Input: N = 34
34 is not a moran number because it is not completely divisible 7 (sum of its digits).
Input: N = 21
21 is a moran number because 21 divided by the sum of its digits gives a prime number.
Approach: To solve the problem mentioned above we have to find the sum of digits of that number. Then find the quotient by dividing the number by the sum of its digits and check if the quotient is a prime then the given number is a Moran Number.
Below is the implementation of the above approach:
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- 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
- Check if a number with even number of digits is palindrome or not
- Program to check whether a number is Proth number or not
- Check if the number is a Prime power number
- Check if a number is a Trojan Number
- Check Whether a number is Duck Number or not
- Check if a number is a power of another number
- Check if a number ends with another number or not
- Check if a number is an Unusual Number or not
- Check if given number is Emirp Number or not
- Check if a given number is factorial of any number
- Check if a number is Triperfect Number
- How to check if a given number is Fibonacci number?
- Check if a number is a Mystery Number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.