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.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

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.

mink maxk Expected result
42
1
2
[21, 22, 41, 44, 82, 84]
1234
1
1
[1134, 1232, 1238, 1264, 1434, 2234]
1234
[634, 1117, 1217, 1268, 1464, 1468,
2434, 2464]
88224
2
3
[44124, 44224, 84114, 84124, 88112,
88114, 88212, 88248, 88444, 88448,
176224, 176424, 816424,816444]
123456789 |7
[61728399, 111728399, 126913578,
146913569, 146913578, 246913489,
246913569, 246913578]
(a list with 65 elements, the last three of which are
[1234567169, 1234567178, 1234567818 ])
123456789 |1
Transcribed Image Text:mink maxk Expected result 42 1 2 [21, 22, 41, 44, 82, 84] 1234 1 1 [1134, 1232, 1238, 1264, 1434, 2234] 1234 [634, 1117, 1217, 1268, 1464, 1468, 2434, 2464] 88224 2 3 [44124, 44224, 84114, 84124, 88112, 88114, 88212, 88248, 88444, 88448, 176224, 176424, 816424,816444] 123456789 |7 [61728399, 111728399, 126913578, 146913569, 146913578, 246913489, 246913569, 246913578] (a list with 65 elements, the last three of which are [1234567169, 1234567178, 1234567818 ]) 123456789 |1
Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY