Given an integer N, the task is to check whether N divides the sum of the factorials of its digits.
Input: N = 19
1! + 9! = 1 + 362880 = 362881 which is divisible by 19.
Input: N = 20
0! + 2! = 1 + 4 = 5 which is not divisible by 20.
Approach: First, store the factorials of all the digits from 0 to 9 in an array. And, for the given number N check if it divides the sum of the factorials of its digits.
Below is the implementation of the above approach:
- Check if the sum of digits of a number N divides it
- Find last two digits of sum of N factorials
- Check whether product of digits at even places is divisible by sum of digits at odd place of a number
- Check if the sum of digits of number is divisible by all of its digits
- Check if a M-th fibonacci number divides N-th fibonacci number
- Check if the frequency of all the digits in a number is same
- Check if two numbers have same number of digits
- Check if a number has digits in the given Order
- Check if the Xor of the frequency of all digits of a number N is zero or not
- Check if all digits of a number divide it
- Check if a number with even number of digits is palindrome or not
- Check if a number is magic (Recursive sum of digits is 1)
- Check if the number is even or odd whose digits and base (radix) is given
- Check whether sum of digits at odd places of a number is divisible by K
- Check if a given number can be represented in given a no. of digits in any base
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.