you will define an operation on positive integers


You will define an operation on positive integers called twiddle which consists of summing the squares of the digits of the input number (when represented as a decimal). Therefore, twiddle(23) = 22 + 32 = 13. A number's twiddle distance is the number of times one must repeatedly apply this operation to get to 1 (one). The twiddle distance of one is zero, and the twiddle distance of 23 is 3 because twiddle(23) = 13, twiddle(13) = 10, and twiddle(10) = 1. Some numbers never reach one, though, because they get stuck in a loop and therefore have infinite twiddle distance. you will call such numbers stuck numbers. Your assignment is to prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments (defining an inclusive range).

Solution Preview :

Prepared by a verified Expert
Python Programming: you will define an operation on positive integers
Reference No:- TGS0446684

Now Priced at $30 (50% Discount)

Recommended (92%)

Rated (4.4/5)