#Z14202. 角谷猜想
角谷猜想
Description
The Collatz Conjecture states that for any positive integer, if it is odd, multiply it by 3 and add 1; if it is even, divide it by 2. Repeat the process with the resulting number, and it will eventually reach 1. For example, starting with 5, the sequence would be 16, 8, 4, 2, 1. The program requires input of an integer and outputs the steps taken to reach 1.
Input Format
A positive integer N (N ≤ 2,000,000).
Output Format
Each step from the input integer to 1 should be printed on a separate line, describing the calculation process.
The last line should output "End". If the input is 1, directly output "End".
Example Input and Output
Input:
5
Output:
5*3+1=16
16/2=8
8/2=4
4/2=2
2/2=1
End
Input:
1
Output:
End
5
5\*3+1=16
16/2=8
8/2=4
4/2=2
2/2=1
End
Hint
no