challenges

my solutions to various "programming challenge" problems
git clone https://wehaveforgeathome.hates.computer/challenges.git
Log | Files | Refs | LICENSE

021.go (299B)


      1 package main
      2 
      3 import "fmt"
      4 
      5 func main() {
      6   d := make(map[int]int)
      7 
      8   sd := 0
      9   for i := 1; i < 10000; i++ {
     10     s := 0
     11     for j := 1; j < i; j++ {
     12       if i % j == 0 {
     13         s += j
     14       }
     15     }
     16     if s < i && d[s] == i {
     17       sd += i
     18       sd += s
     19     }
     20     d[i] = s
     21   }
     22   fmt.Println(sd)
     23 }