Skip to content

Instantly share code, notes, and snippets.

@moul moul/main.go
Created Sep 4, 2019

Embed
What would you like to do?
same age
package main
import "fmt"
func isrev(a, b int) bool {
astr := fmt.Sprintf("%d", a)
bstr := fmt.Sprintf("%d", b)
arev := astr[1:2] + astr[0:1]
brev := bstr[1:2] + bstr[0:1]
return a != b && (astr == brev || bstr == arev)
}
func main() {
for a := 11; a < 100; a++ {
for b := 11; b < 100; b++ {
if isrev(a, b) {
fmt.Println(a, b)
for i := 1; a+i < 100 && b+i < 100; i++ {
if isrev(a+i, b+i) {
fmt.Println(" ", a+i, b+i)
}
if isrev(a+i+1, b+i) {
fmt.Println(" ", a+i+1, b+i)
}
if isrev(a+i, b+i+1) {
fmt.Println(" ", a+i, b+i+1)
}
}
}
}
}
}
@moul

This comment has been minimized.

Copy link
Owner Author

commented Sep 4, 2019

12 21
   23 32
   34 43
   45 54
   56 65
   67 76
   78 87
   89 98
13 31
   24 42
   35 53
   46 64
   57 75
   68 86
   79 97
14 41
   25 52
   36 63
   47 74
   58 85
   69 96
15 51
   26 62
   37 73
   48 84
   59 95
16 61
   27 72
   38 83
   49 94
17 71
   28 82
   39 93
18 81
   29 92
19 91
21 12
   32 23
   43 34
   54 45
   65 56
   76 67
   87 78
   98 89
23 32
   34 43
   45 54
   56 65
   67 76
   78 87
   89 98
24 42
   35 53
   46 64
   57 75
   68 86
   79 97
25 52
   36 63
   47 74
   58 85
   69 96
26 62
   37 73
   48 84
   59 95
27 72
   38 83
   49 94
28 82
   39 93
29 92
31 13
   42 24
   53 35
   64 46
   75 57
   86 68
   97 79
32 23
   43 34
   54 45
   65 56
   76 67
   87 78
   98 89
34 43
   45 54
   56 65
   67 76
   78 87
   89 98
35 53
   46 64
   57 75
   68 86
   79 97
36 63
   47 74
   58 85
   69 96
37 73
   48 84
   59 95
38 83
   49 94
39 93
41 14
   52 25
   63 36
   74 47
   85 58
   96 69
42 24
   53 35
   64 46
   75 57
   86 68
   97 79
43 34
   54 45
   65 56
   76 67
   87 78
   98 89
45 54
   56 65
   67 76
   78 87
   89 98
46 64
   57 75
   68 86
   79 97
47 74
   58 85
   69 96
48 84
   59 95
49 94
51 15
   62 26
   73 37
   84 48
   95 59
52 25
   63 36
   74 47
   85 58
   96 69
53 35
   64 46
   75 57
   86 68
   97 79
54 45
   65 56
   76 67
   87 78
   98 89
56 65
   67 76
   78 87
   89 98
57 75
   68 86
   79 97
58 85
   69 96
59 95
61 16
   72 27
   83 38
   94 49
62 26
   73 37
   84 48
   95 59
63 36
   74 47
   85 58
   96 69
64 46
   75 57
   86 68
   97 79
65 56
   76 67
   87 78
   98 89
67 76
   78 87
   89 98
68 86
   79 97
69 96
71 17
   82 28
   93 39
72 27
   83 38
   94 49
73 37
   84 48
   95 59
74 47
   85 58
   96 69
75 57
   86 68
   97 79
76 67
   87 78
   98 89
78 87
   89 98
79 97
81 18
   92 29
82 28
   93 39
83 38
   94 49
84 48
   95 59
85 58
   96 69
86 68
   97 79
87 78
   98 89
89 98
91 19
92 29
93 39
94 49
95 59
96 69
97 79
98 89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.