示例#1
0
func Euler29() string {
	distinct := make(map[string]int)
	for a := 2; a <= 100; a++ {
		for b := a; b <= 100; b++ {
			distinct[bigextension.Pow(big.NewInt(int64(a)), int64(b)).String()] = 0
			distinct[bigextension.Pow(big.NewInt(int64(b)), int64(a)).String()] = 0
		}
	}
	return fmt.Sprint(len(distinct))
}
示例#2
0
func Euler16() string {
	str := bigextension.Pow(big.NewInt(2), 1000).String()
	sum := 0
	digit := 0
	for _, char := range str {
		digit, _ = strconv.Atoi(string(char))
		sum += digit
	}
	return fmt.Sprint(sum)
}