I have an algorithm that encodes a number with following rules: -while number has more than one digit, algorithm finds the sum of its digits (e.g. 38 -> 3 + 8 = 11 -> 1 + 1 = 2) -then algorithm returns the sum of all results (from the example above: 38 + 11 + 2 = 51)
So, given a range of numbers, how can I decode it, if it's possible, or just say, that it isn't obtainable by the encoding algorithm (brute force is not an option, since the range could be very wide)
Comments
Post a Comment