Թաքցված խնդիր
|Այս խնդիրը թաքցված է խմբագրական խրհրդի անդամի կողմից քանի որ կամ այն ոչ ճիշտ լեզվով է գրված,|կամ թեստային տվյալներն են սխալ, կամ խնդրի ձևակերպումը պարզ չէ։|

ACM_0136 - COLLATS CONJECTURE

  The Collatz conjecture which is also known as the 3n + 1 conjecture is a very well known and old conjecture in mathematics. The conjecture is as follows. Take any natural number n. If n is even, divided by two to get n/2 and if n is odd number greater than 1, triple it and add one to obtain 3n + 1. Repeat this process to get a sequence of natural numbers known as the Hailstone sequence. The conjecture is that no matter what number you start, you always reach 1. The hailstone sequence for n = 3 is “3, 10, 5, 16, 8, 4, 2, 1”. Paul Erdos said “Mathematics is not yet ripe for such problems” and offered $500 for its solution. Now it ‘s time to show Erdos that the Collatz conjecture can be proved for small numbers in 11th Iran Internet Programming Contest. You are to write a program that computes the length of the Hailstone sequence for the given n.

Input

   There are multiple test cases in the input. Each test case consists of a line containing a non-negative integers 0 ≤ n ≤ 100. The input terminates with “0” which should not be processed.

Output

   For each test case, output the length of the Hailstone sequence in one line.

Examples

stdin

stdout

1

1

2

3

0

1

2

8


Ավելացրեց.Հրանտ Հովհաննիսյան
Ամսաթիվ.2014-02-09
Ժամանակի սահմանափակումը.1s
Ծրագրի տեքստի սահմանափակումը.50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Լեզուներ.Բոլորը բացի ASM32 ASM64 GAWK CLPS CLOJURE D ERL FSHARP FORTRAN GOSU HASK ICON ICK NEM NIM OBJC-CLANG PICO PIKE PYPY PYPY3 PY_NBC RUST SCM guile CHICKEN SED TCL WHITESPACE
Աղբյուրը.Iran Internet 2013.A

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.