...
1
2
3
4
5 package main
6
7 import (
8 "fmt"
9 "os"
10 )
11
12 func main() {
13 x := f(60)
14 fmt.Println(x)
15 if x != 54 {
16 os.Exit(11)
17 }
18 }
19
20 var escape *int
21
22 func f(i int) int {
23 a := 0
24 outer:
25 for {
26 switch {
27 case i > 55:
28 i--
29 continue
30 case i == 55:
31 for j := i; j != 1; j = j / 2 {
32 a++
33 if j == 4 {
34 escape = &j
35 i--
36 continue outer
37 }
38 if j&1 == 1 {
39 j = 2 * (3*j + 1)
40 }
41 }
42 return a
43 case i < 55:
44 return i
45 }
46 }
47 }
48
View as plain text