From faff2eb16077f0d86140162cc06adc48bbc35e60 Mon Sep 17 00:00:00 2001 From: Swastika Gupta <64654203+Swastyy@users.noreply.github.com> Date: Fri, 23 Jul 2021 19:53:41 +0530 Subject: [PATCH] Update bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp Co-authored-by: David Leal --- .../count_of_trailing_ciphers_in_factorial_n.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp b/bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp index 418d5a77c..b18d48191 100644 --- a/bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp +++ b/bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp @@ -2,8 +2,12 @@ * @file * @brief [Count the number of ciphers](https://www.tutorialspoint.com/count-trailing-zeros-in-factorial-of-a-number-in-cplusplus) in `n!` implementation * @details - * We are given a number. The algorithm finds all - * the zeroes at the end of factorial of that number. + * Given an integer number as input. The goal is to find the number of trailing zeroes in the factorial calculated for + * that number. A factorial of a number N is a product of all numbers in the range [1, N]. + + * We know that we get a trailing zero only if the number is multiple of 10 or has a factor pair (2,5). In all factorials of + * any number greater than 5, we have many 2s more than 5s in the prime factorization of that number. Dividing a + * number by powers of 5 will give us the count of 5s in its factors. So, the number of 5s will tell us the number of trailing zeroes. * @author [Swastika Gupta](https://github.com/Swastyy) */