func Euler028(size int) int { TRxDL := make([]int, 0, size-1) TLxDR := make([]int, 0, size-1) for i := 3; i <= size; i += 2 { tr := i * i TRxDL = append(TRxDL, tr, tr-2*(i-1)) TLxDR = append(TLxDR, tr-(i-1), tr-3*(i-1)) } return utils.Sum(TRxDL) + utils.Sum(TLxDR) + 1 }
func Euler023(limit int) int { abNums := []int{} for i := 1; i < limit; i++ { d := utils.Divisors(i) if utils.Sum(d[:len(d)-1]) > i { abNums = append(abNums, i) } } possibleSums := make(map[int]bool) for _, a1 := range abNums { for _, a2 := range abNums { if a1+a2 < limit { possibleSums[a1+a2] = true } } } sum := 0 for i := 0; i < limit; i++ { if !possibleSums[i] { sum += i } } return sum }