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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
package main
import (
"fmt"
)
type num struct {
v,i int
}
var it = 0
func fillByFormule( slc *[]int, form func (int) int) {
it++
for n, i := 0, 0 ; n < 10000 ; i++ {
if n > 999 && n < 10000 {
if n % 100 > 9 {
*slc = append(*slc, num{v=n, i=it})
}
}
n = form(i)
}
}
func fillByNumber( dict map[int][]int, num []int) {
for _,n := range num {
dict[n/100] = append(dict[n/100], n%100)
}
}
func main () {
trin := []int{}
sqrt := []int{}
pent := []int{}
hexa := []int{}
hept := []int{}
octa := []int{}
numMap := make(map[int][]num)
/*
hexaMap := make(map[int][]int)
heptMap := make(map[int][]int)
octaMap := make(map[int][]int)
*/
fillByFormule(&trin, func(x int) int { return (x*(x+1))>>1 })
fillByFormule(&sqrt, func(x int) int { return x*x })
fillByFormule(&pent, func(x int) int { return (x*(3*x-1))>>1 })
fillByFormule(&hexa, func(x int) int { return x*(2*x-1) })
fillByFormule(&hept, func(x int) int { return (x*(5*x-3))>>1 })
fillByFormule(&octa, func(x int) int { return x*(3*x-2) })
fillByNumber(numMap, trin, 1)
fillByNumber(numMap, sqrt, 2)
/*
fillByNumber(sqrtMap, sqrt)
fillByNumber(pentMap, pent)
*/
fmt.Println(trin)
fmt.Println(numMap)
pile := []int{}
empiler := func(i []int) {
pile = append(pile, i...)
}
empiler(pent)
for len(pile) != 0{
n_1 := n / 100
n_2 := n % 100
cycle := []int{n8}
numberType := []int{0}
for len(cycle) != 3 {
}
if _,ok := numMap[n_2] ; ok {
for
for _, n1_2 := range numMap[n_2] {
if _,ok := trinMap[n1_2] ; ok {
for _, n2 := range trinMap[n1_2] {
n2_2 := n2 % 100
if n2_2 == n8_1 {
fmt.Println(n1_2, n2_2, n8_2)
}
}
}
}
}
}
fmt.Println(len(trin))
fmt.Println(len(sqrt))
fmt.Println(len(pent))
fmt.Println(len(hexa))
fmt.Println(len(hept))
fmt.Println(len(octa))
}
|