Skip to content

Commit 9ead424

Browse files
authored
Create 793-preimage-size-of-factorial-zeroes-function.js
1 parent f308a9b commit 9ead424

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @param {number} K
3+
* @return {number}
4+
*/
5+
const preimageSizeFZF = function(K) {
6+
let last = 1
7+
while (last < K) last = last * 5 + 1
8+
while (last > 1) {
9+
K %= last
10+
if (last - 1 == K) return 0
11+
last = ((last - 1) / 5) >> 0
12+
}
13+
return 5
14+
}

0 commit comments

Comments
 (0)