Digits
Time limit1sMemory limit128 MB
Given a huge decimal number, repeatedly replace it with its digit count and report the first step where the value stops changing.
- Level
Medium4 of 10
- Topics
- Math, Implementation, Simulation, String
- Solved
- No attempts yet
Problem
A googol written out in decimal has digits. A googolplex has one plus a googol digits. That's a lot of digits!
Given any number , define a sequence by the recurrence
Your task is to determine the smallest positive such that .
Input
The input consists of several lines. Each line contains a value of . Every value of is non-negative and has no more than one million digits. The last line of input contains the word END.
Output
For each value of in the input, output one line containing the smallest positive such that .