Exemple #1
0
func Euler010() int {
	primes := utils.AtkinSieve(2000000)
	numPrimes := len(primes)
	sum := 0
	for i := 0; i < numPrimes; i++ {
		sum += primes[i]
	}
	return sum
}
Exemple #2
0
func Euler035() int {
	primes := utils.AtkinSieve(1000000)
	circulars := make(map[int]bool)
	for _, p := range primes {
		if circulars[p] {
			continue
		}
		circular := true
		rots := rotations(p)
		for _, r := range rots {
			if !utils.IsPrime(r) {
				circular = false
				break
			}
		}
		if circular {
			for _, r := range rots {
				circulars[r] = true
			}
		}
	}
	return len(circulars)
}