-
Notifications
You must be signed in to change notification settings - Fork 0
/
23.go
61 lines (54 loc) · 1007 Bytes
/
23.go
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
package main
import (
"fmt"
"math"
)
func d(i int) int {
l := int(math.Sqrt(float64(i)))
sum := 1
//fmt.Printf("intput: %d : 1 ", i)
for j:=2;j<=l;j++ {
if i % j == 0 {
n := i / j
if n < j { break }
sum += j
//fmt.Printf("%d ", j)
if n != j { sum += n
//fmt.Printf("%d ", n)
}
}
}
//fmt.Println()
return sum
}
func main() {
n := 28123
rt := make([]int, n )
for i,_ := range rt { rt[i] = 0 }
for i:= 1; i<n;i++ {
rt[i] = d(i)
}
mark := make([]bool, n)
for i,_ := range mark { mark[i] = false }
for i:=12;i<n;i++ {
if rt[i] <= i { continue }
for j:=i;j<n;j++ {
if rt[j] <= j { continue }
sum := i + j
if sum < len(mark) {
mark[sum] = true
}
}
}
sum := 0
for i,j := range mark{
if ! j {
sum += i
}
}
//for i,j := range rt{
//fmt.Printf( " d(%d)=%d",i,j )
//if i % 15 == 0 { fmt.Println() }
//}
fmt.Printf( "\n result : %d", sum)
}