Brussel's choice def brussels_choice_step(n, mink, maxk): This problem is adapted from another jovial video "The Brussel's Choice" of Numberphile (a site so British that you just know there has to be a Trevor and a Colin somewhere in there) whose first five minutes you should watch to get an idea of what is going on. This function should compute and return the list of all numbers that the positive integer n can be converted to by treating it as a string and replacing some substring m of its digits with the new substring of either 2*m or m/2, the latter substitution allowed only when m is even so that dividing it by two produces an integer. This function should return the list of numbers that can be produced from n in a single step. To keep the results more manageable, we also impose an additional constraint that the number of digits in the chosen substring m must be between mink and maxk, inclusive. The returned list must contain the numbers in ascending sorted order.
Brussel's choice
def brussels_choice_step(n, mink, maxk):
This problem is adapted from another jovial video "The Brussel's Choice" of Numberphile (a site so British that you just know there has to be a Trevor and a Colin somewhere in there) whose first five minutes you should watch to get an idea of what is going on. This function should compute and
return the list of all numbers that the positive integer n can be converted to by treating it as a string and replacing some substring m of its digits with the new substring of either 2*m or m/2, the latter
substitution allowed only when m is even so that dividing it by two produces an integer.
This function should return the list of numbers that can be produced from n in a single step. To keep the results more manageable, we also impose an additional constraint that the number of digits in the chosen substring m must be between mink and maxk, inclusive. The returned list must contain the numbers in ascending sorted order.
Step by step
Solved in 2 steps with 3 images