Given a number N. The task is to find the total Number of Digits in .
Input: N = 3 Output: 3 If N=3, (3!)3=216, So the count of digits is 3 Input: N = 4 Output: 6
As we know, log(a*b) = log(a) + log(b) Consider, X = log(N!) = log(1*2*3....... * N) = log(1)+log(2)+........ +log(N)
Now, we know that the floor value of log base 10 increased by 1, of any number, gives the number of digits present in that number. That is, number of digits in a number say N will be floor(log10N) + 1.
Therefore, number of digit in will be:
floor(log())+1 = floor(N*log10(N!)) + 1 = floor(N*X) + 1.
Below is the implementation of the above approach:
- Count total number of digits from 1 to n
- Total number of non-decreasing numbers with n digits
- Count total number of N digit numbers such that the difference between sum of even and odd digits is 1
- Find the average of k digits from the beginning and l digits from the end of the given number
- Find the total number of composite factor for a given number
- Find the Largest number with given number of digits and sum of digits
- Program to find total number of edges in a Complete Graph
- Find out the minimum number of coins required to pay total amount
- Total numbers with no repeated digits in a range
- Find the number of positive integers less than or equal to N that have an odd number of digits
- Find maximum number that can be formed using digits of a given number
- Find the smallest number whose digits multiply to a given number n
- Find count of digits in a number that divide the number
- Find first and last digits of a number
- Given a number n, find the first k digits of n^n
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.