-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10.go
More file actions
36 lines (32 loc) · 750 Bytes
/
10.go
File metadata and controls
36 lines (32 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"fmt"
"strconv"
)
func main(){
sequence := "1"
i := 0
for i < 30 {
temp := ""
fast, slow := 0, 0
for slow < len(sequence) {
char := string(sequence[slow])
for fast < len(sequence) && sequence[fast] == sequence[slow] {
fast++
}
diff := fast - slow
slow = fast
times := strconv.Itoa(diff)
temp += times + char
}
N := len(sequence)
if N <= 42 {
fmt.Println(i, "/", sequence)
} else {
fmt.Println(i, "/ len/", N)
}
sequence = temp
i++
}
fmt.Println(/*"end/", sequence,*/ "len/", len(sequence))
}