Skip to content

Instantly share code, notes, and snippets.

@fl3xice
Created July 1, 2022 17:07
Show Gist options
  • Save fl3xice/a09ff382340b8e27858f03a4444337be to your computer and use it in GitHub Desktop.
Save fl3xice/a09ff382340b8e27858f03a4444337be to your computer and use it in GitHub Desktop.
Counting numbers of zeros
function countZeros(n: number) {
let count = 0;
let l = 2;
for (let i = 5; i < Math.pow(n, n); i = Math.pow(i, l), l++) {
const s = n / i;
if (s % 1 > 0) {
break;
}
count += s;
}
return count;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment