func c092GetLoopNumber(starting int) int { for starting != 1 && starting != 89 { sum := 0 for _, digit := range utils.NumberDigits(starting) { sum += digit * digit } starting = sum } return starting }
func C030() (interface{}, error) { total := 0 for nb := 2; nb < 1000000; nb++ { sum := 0 for _, digit := range utils.NumberDigits(nb) { sum += utils.IntPow(digit, 5) } if sum == nb { total += sum } } return total, nil }
func C034() (interface{}, error) { total := 0 for nb := 3; nb < 100000; nb++ { factSum := big.NewInt(0) for _, digit := range utils.NumberDigits(nb) { factSum = factSum.Add(factSum, utils.Factorial(digit)) } if strconv.Itoa(nb) == factSum.String() { total += nb } } return total, nil }