-->
当前位置:首页 > 题库

PROGRAMMING:Trapped numbers

Luz5年前 (2021-05-10)题库369
For any natural number $$n_ 0 $$, first add all its digits, then multiply the sum by 3 and add 1 to make a new natural number $$n_ 1$$; Then for $$n_ 1 $$repeat this operation to generate a new natural number $$n_ 2$$;…… Repeat this operation many times, and the result will be a fixed number $$n_ K $$, like falling into a digital "trap.".
This problem requires the input of natural numbers, given its fall into the "trap" process.
###Input format:
Give a natural number $$n in one line_ 0$$($$N_ 0 <$$30000)。
###Output format:
For the input $$n_ 0 $$, output the steps of falling into the trap line by line. The $$I $$line describes the $$I $$step in which $$n $$falls into the trap. The format is: $$I $$: $$n_ i$$ ($$i\ge 1$$)。 When the natural number result of a certain step is $$n_ K $$($$K / GE1 $$) and previous $$n_{ When k-1} $$is the same, the output is stopped.
###Input example:
```in
five
```
###Output example:
```out
1:16
2:22
3:13
4:13
```






answer:If there is no answer, please comment