Skip to content

Commit 789e56a

Browse files
authored
Add new algorithm (is_K_power_of_N)
1 parent 434a6fb commit 789e56a

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

bit_manipulation/is_K_power_of_N.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
def is_k_power_of_n(n, k):
44
"""
55
Checks if k can be reduced to 1 by repeatedly dividing it by n.
6+
7+
>>> 2
8+
>>> 8
9+
True
10+
11+
>>> 1092
12+
>>> 20,21,99,97,93,72,24,99,35,25,59,616
13+
True
14+
15+
>>>12
16+
>>>100
17+
False
618
"""
719
if n == 1:
820
return k == 1

0 commit comments

Comments
 (0)