Exemple #1
0
//10^(p−1) = 1 (mod p).
func cycle(d int) int {
	for i := 1; i <= d; i++ {
		bd := big.NewInt(int64(d))
		if 1 == new(big.Int).Mod(utils.Pow(10, i), bd).Int64() {
			return i
		}
	}
	return 0
}
Exemple #2
0
func Euler029() int {
	limit := 100
	set := make(map[string]bool)
	for a := 2; a <= limit; a++ {
		for b := 2; b <= limit; b++ {
			set[utils.Pow(a, b).String()] = true
		}
	}
	return len(set)
}