The shortest code to pass all possibilities wins.
In mathematics, the persistence of a number measures how many times a certain operation must be applied to its digits until some certain fixed condition is reached. You can determine the additive persistence of a positive integer by adding the digits of the integer and repeating. You would keep adding the digits of the sum until a single digit number is found. The number of repetitions it took to reach that single digit number is the additive persistence of that number.
Example using 84523:
84523 8 + 4 + 5 + 2 + 3 = 22 2 + 2 = 4 It took two repetitions to find the single digit number. So the additive persistence of 84523 is 2.
You will be given a sequence of positive integers that you have to calculate the additive persistence of. Each line will contain a different integer to process. Input may be in any standard I/O methods.
For each integer, you must output the integer, followed by a single space, followed by its additive persistence. Each integer processed must be on its own line.
99999999999 3 10 1 8 0 19999999999999999999999 4 6234 2 74621 2 39 2 2677889 3 0 0