Factorial trailing zeroes thing

This commit is contained in:
Dan Buch 2023-10-27 16:12:17 -04:00
parent efc1c8f029
commit 5df7489f27
Signed by: meatballhat
GPG Key ID: A12F782281063434

View File

@ -498,3 +498,14 @@ class Trie:
and (current_node.is_leaf or prefix_ok)
and current_node.value == word
)
def count_factorial_trailing_zeroes(number: int) -> int:
divisor: int = 5
zeroes_count: int = 0
while divisor <= number:
zeroes_count += number // divisor
divisor *= 5
return zeroes_count