123 s Zeroes Trick, shorts
You can determine the number of trailing zeroes on a factorial of ANY size with a pretty simple trick that involves dividing by powers of 5. First, you can do it the hard way, and multiple every number of x (x (x 1) (x until you re multiplying by 1 at the end, and then just count up the zeroes. you can do it the smart way. Divide your original number by 5, then 52, then 53, and when you ve got a fractional value, stop and add up the roundeddown whole numbers. And BAM That s how many trailing zeroes x has. It really is that easy, even for a 206digit number like 123 , shorts
|
|