Given an integer N, the task is to find the number of trailing zeroes in the base 16 representation of the factorial of N.
Input: N = 6
6! = 720 (base 10) = 2D0 (base 16)
Input: N = 100
- Number of trailing zeroes would be the highest power of 16 in the factorial of N in base 10.
- We know that 16 = 24. So, the highest power of 16 is equal to the highest power 2 in the factorial of N divided by 4.
- To calculate the highest power of 2 in N!, we can use Legendre’s Formula.
Below is the implementation of the above approach:
- Number of trailing zeroes in base B representation of N!
- Smallest number with at least n trailing zeroes in factorial
- Count trailing zeroes in factorial of a number
- Number of trailing zeros in N * (N - 2) * (N - 4)*....
- Trailing number of 0s in product of two factorials
- Find the smallest number X such that X! contains at least Y trailing zeros.
- Find the length of factorial of a number in any given base
- Sum of digits with even number of 1's in their binary representation
- Next greater number than N with exactly one bit different in binary representation of N
- Number of mismatching bits in the binary representation of two integers
- Find consecutive 1s of length >= n in binary representation of a number
- Sum of decimal equivalent of all possible pairs of Binary representation of a Number
- Maximum number of consecutive 1's in binary representation of all the array elements
- Count number of triplets with product equal to given number with duplicates allowed
- Count number of triplets with product equal to given number with duplicates allowed | Set-2
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.