Polydivisible number: Difference between revisions

Content deleted Content added
Line 320:
==Programming example==
The example below searches for polydivisible numbers in [[Python (programming language)|Python]].
<source lang="python">
def find_polydivisible(base: int) -> List[int]:
numbers = []
previous = []
for i in range(1, base):
previous.append(i)
new = []
digits = 2
while not previous == []:
numbers.append(previous)
for i in range(0, len(previous)):
for j in range(0, base):
number = previous[i] * base + j
if number % digits == 0:
new.append(number)
previous = new
new = []
digits = digits + 12
while not previous == []:
return numbers
numbers.append(previous)
for i in range(0, len(previous)):
for j in range(0, base):
number = previous[i] * base + j
if number % digits == 0:
new.append(number)
previous = new
new = []
digits = 2digits + 1
return numbers
</source>