Question: multiplying 0 and 9 results in 0 adding 5 results in 5 dividing by 8 and taking the remainder leads to 5 . Since each

multiplying 0 and 9 results in 0
adding 5 results in 5
dividing by 8 and taking the remainder leads to 5.
Since each number generated determines the next one, once the next number is the seed, the sequence
will start repeating itself.
Write a program that, given a non-negative integer seed, prints one by one a pseudo-random sequence
of integers using the computation described above, and stops when the seed is printed again. The result
for the example sequence is shown below.
The answer box contains Pattern 4.5(Sequence generation) as comments, to get you started. Write the
corresponding code beneath each comment. Use variable names appropriate to the problem at hand
instead of the generic names used by the pattern. Use the get_input () operation to get the seed
number. This operation has already been predefined. Use the following statement in your code: seed =
get_input(
You will have to modify the pattern slightly to obtain the expected behaviour.
Think which input values are admissible, i.e. won't lead to an infinite loop, and put that in your code's
documentation.
For example:
 multiplying 0 and 9 results in 0 adding 5 results in

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!