Using the Collatz Conjecture
Go from 7 to 1
This takes 16 steps
We start with n = 7
Step 1 of 16 → n = 7
7 is odd
Multiply 3 by 7 and add 1
3(7) + 1
21 + 1
22
Step 2 of 16 → n = 22
22 is even
Divide 22 by 2
22 ÷ 2 = 11
Step 3 of 16 → n = 11
11 is odd
Multiply 3 by 11 and add 1
3(11) + 1
33 + 1
34
Step 4 of 16 → n = 34
34 is even
Divide 34 by 2
34 ÷ 2 = 17
Step 5 of 16 → n = 17
17 is odd
Multiply 3 by 17 and add 1
3(17) + 1
51 + 1
52
Step 6 of 16 → n = 52
52 is even
Divide 52 by 2
52 ÷ 2 = 26
Step 7 of 16 → n = 26
26 is even
Divide 26 by 2
26 ÷ 2 = 13
Step 8 of 16 → n = 13
13 is odd
Multiply 3 by 13 and add 1
3(13) + 1
39 + 1
40
Step 9 of 16 → n = 40
40 is even
Divide 40 by 2
40 ÷ 2 = 20
Step 10 of 16 → n = 20
20 is even
Divide 20 by 2
20 ÷ 2 = 10
Step 11 of 16 → n = 10
10 is even
Divide 10 by 2
10 ÷ 2 = 5
Step 12 of 16 → n = 5
5 is odd
Multiply 3 by 5 and add 1
3(5) + 1
15 + 1
16
Step 13 of 16 → n = 16
16 is even
Divide 16 by 2
16 ÷ 2 = 8
Step 14 of 16 → n = 8
8 is even
Divide 8 by 2
8 ÷ 2 = 4
Step 15 of 16 → n = 4
4 is even
Divide 4 by 2
4 ÷ 2 = 2
Step 16 of 16 → n = 2
2 is even
Divide 2 by 2
2 ÷ 2 = 1
Final Answer
1 in 16 steps
tarcount = 17
key = 1
pos = 0
valcount = 3
Skey = 0
Steps[1][0]
Skey = 1
Steps[1][1]
Skey = 2
Steps[1][2]
Skey = 3
Steps[1][3]
key = 2
pos = 1
valcount = 5
Skey = 0
Steps[2][0]
Skey = 1
Steps[2][1]
Skey = 2
Steps[2][2]
Skey = 3
Steps[2][3]
Skey = 4
Steps[2][4]
Skey = 5
Steps[2][5]
key = 3
pos = 2
valcount = 3
Skey = 0
Steps[3][0]
Skey = 1
Steps[3][1]
Skey = 2
Steps[3][2]
Skey = 3
Steps[3][3]
key = 4
pos = 3
valcount = 5
Skey = 0
Steps[4][0]
Skey = 1
Steps[4][1]
Skey = 2
Steps[4][2]
Skey = 3
Steps[4][3]
Skey = 4
Steps[4][4]
Skey = 5
Steps[4][5]
key = 5
pos = 4
valcount = 3
Skey = 0
Steps[5][0]
Skey = 1
Steps[5][1]
Skey = 2
Steps[5][2]
Skey = 3
Steps[5][3]
key = 6
pos = 5
valcount = 5
Skey = 0
Steps[6][0]
Skey = 1
Steps[6][1]
Skey = 2
Steps[6][2]
Skey = 3
Steps[6][3]
Skey = 4
Steps[6][4]
Skey = 5
Steps[6][5]
key = 7
pos = 6
valcount = 3
Skey = 0
Steps[7][0]
Skey = 1
Steps[7][1]
Skey = 2
Steps[7][2]
Skey = 3
Steps[7][3]
key = 8
pos = 7
valcount = 3
Skey = 0
Steps[8][0]
Skey = 1
Steps[8][1]
Skey = 2
Steps[8][2]
Skey = 3
Steps[8][3]
key = 9
pos = 8
valcount = 5
Skey = 0
Steps[9][0]
Skey = 1
Steps[9][1]
Skey = 2
Steps[9][2]
Skey = 3
Steps[9][3]
Skey = 4
Steps[9][4]
Skey = 5
Steps[9][5]
key = 10
pos = 9
valcount = 3
Skey = 0
Steps[10][0]
Skey = 1
Steps[10][1]
Skey = 2
Steps[10][2]
Skey = 3
Steps[10][3]
key = 11
pos = 10
valcount = 3
Skey = 0
Steps[11][0]
Skey = 1
Steps[11][1]
Skey = 2
Steps[11][2]
Skey = 3
Steps[11][3]
key = 12
pos = 11
valcount = 3
Skey = 0
Steps[12][0]
Skey = 1
Steps[12][1]
Skey = 2
Steps[12][2]
Skey = 3
Steps[12][3]
key = 13
pos = 12
valcount = 5
Skey = 0
Steps[13][0]
Skey = 1
Steps[13][1]
Skey = 2
Steps[13][2]
Skey = 3
Steps[13][3]
Skey = 4
Steps[13][4]
Skey = 5
Steps[13][5]
key = 14
pos = 13
valcount = 3
Skey = 0
Steps[14][0]
Skey = 1
Steps[14][1]
Skey = 2
Steps[14][2]
Skey = 3
Steps[14][3]
key = 15
pos = 14
valcount = 3
Skey = 0
Steps[15][0]
Skey = 1
Steps[15][1]
Skey = 2
Steps[15][2]
Skey = 3
Steps[15][3]
key = 16
pos = 15
valcount = 3
Skey = 0
Steps[16][0]
Skey = 1
Steps[16][1]
Skey = 2
Steps[16][2]
Skey = 3
Steps[16][3]
key = 17
pos = 16
valcount = 3
Skey = 0
Steps[17][0]
Skey = 1
Steps[17][1]
Skey = 2
Steps[17][2]
Skey = 3
Steps[17][3]
key = 18
pos = 17
valcount = 1
Skey = 0
Steps[18][0]
Skey = 1
Steps[18][1]