IRSOS6ATDQ4JYXRGG6WRR32CUTNW2TRBSF4J4N733V2G5L3IOZNAC
// genPrimesAtkin generates the sieve usint Atkin's method. Returns true for primes.
// https://www.geeksforgeeks.org/sieve-of-atkin/
func genPrimesAtkin(limit int) []bool {
sieve := make([]bool, limit+1)
// Atkin do not care about these, set them manually
sieve[2] = true
sieve[3] = true
for x := 1; x*x < limit; x++ {
for y := 1; y*y < limit; y++ {
n := (4 * x * x) + (y * y)
if n <= limit && (n%12 == 1 || n%12 == 5) {
sieve[n] = !sieve[n]
}
n = (3 * x * x) + (y * y)
if n <= limit && n%12 == 7 {
sieve[n] = !sieve[n]
}
n = (3 * x * x) - (y * y)
if x > y && n <= limit && n%12 == 11 {
sieve[n] = !sieve[n]
}
}
}
for r := 5; r*r < limit; r++ {
if sieve[r] {
for i := r * r; i < limit; i += r * r {
sieve[i] = false
}
}
}
return sieve
}