Article snapshot taken from Wikipedia with creative commons attribution-sharealike license.
Give it a read and then ask your questions in the chat.
We can research this topic together.
Let be the number of digits. The function determines the number of polydivisible numbers that has digits in base , and the function is the total number of polydivisible numbers in base .
If is a polydivisible number in base with digits, then it can be extended to create a polydivisible number with digits if there is a number between and that is divisible by . If is less or equal to , then it is always possible to extend an digit polydivisible number to an -digit polydivisible number in this way, and indeed there may be more than one possible extension. If is greater than , it is not always possible to extend a polydivisible number in this way, and as becomes larger, the chances of being able to extend a given polydivisible number become smaller. On average, each polydivisible number with digits can be extended to a polydivisible number with digits in different ways. This leads to the following estimate for :
Summing over all values of n, this estimate suggests that the total number of polydivisible numbers will be approximately
The example below searches for polydivisible numbers in Python.
def find_polydivisible(base: int) -> list:
"""Find polydivisible number."""
numbers =
previous =
new =
digits = 2
while not previous == :
numbers.append(previous)
for n in previous:
for j in range(0, base):
number = n * base + j
if number % digits == 0:
new.append(number)
previous = new
new =
digits = digits + 1
return numbers
Related problems
Polydivisible numbers represent a generalization of the following well-known problem in recreational mathematics:
Arrange the digits 1 to 9 in order so that the first two digits form a multiple of 2, the first three digits form a multiple of 3, the first four digits form a multiple of 4 etc. and finally the entire number is a multiple of 9.
The solution to the problem is a nine-digit polydivisible number with the additional condition that it contains the digits 1 to 9 exactly once each. There are 2,492 nine-digit polydivisible numbers, but the only one that satisfies the additional condition is
381 654 729
Other problems involving polydivisible numbers include:
Finding polydivisible numbers with additional restrictions on the digits - for example, the longest polydivisible number that only uses even digits is
48 000 688 208 466 084 040
Finding palindromic polydivisible numbers - for example, the longest palindromic polydivisible number is
30 000 600 003
A common, trivial extension of the aforementioned example is to arrange the digits 0 to 9 to make a 10 digit number in the same way, the result is 3816547290. This is a pandigital polydivisible number.
^ Parker, Matt (2014), "Can you digit?", Things to Make and Do in the Fourth Dimension, Particular Books, pp. 7–8, ISBN9780374275655 – via Google Books