Back
Close

3n+1 Problem

Statement
3n+1 Problem is a problem that we still cannot solve. Here's the problem: Pick a positive integer. If it is an odd number, multiply it by 3 and add 1 into it. If it is an even number, divide it by 2. Keep doing the process and you will eventually be stuck in a 4, 2, 1 loop. <<Task: >> You will be given an integer [[i]]. Print how many steps it takes to reach 1 by <<1. Odd Number:>> Multiply the integer by 3 and add 1. or <<2. Even Number:>> Divide it by two. Also, output the maximum number it has reached.

Input description
<<Line 1:>> An integer [[i]]

Output description
<<Line 1:>> Output how many steps it has taken to reach 1. <<Line 2:>> Output the maximum number it has reached

Constraints
0<[[i]]<100000

Game modes
Fastest, Shortest

Test cases
Test 1 Test
Input
4
Output
2 4

Validator 1 Validator
Input
12
Output
9 16

Test 2 Test
Input
19
Output
20 88

Validator 2 Validator
Input
18
Output
20 52

Test 3 Test
Input
27
Output
111 9232

Validator 3 Validator
Input
96
Output
12 96

Test 4 Test
Input
10568
Output
104 15064

Validator 4 Validator
Input
7854
Output
83 26512

Solution language

Solution

Stub generator input