Numbers whose count of divisors is prime: Difference between revisions

Content added Content deleted
(→‎{{header|Wren}}: Takes account of Horsth's observation that only square numbers need to be tested.)
(→‎{{header|Go}}: Takes account of Horsth's observation that only square numbers need to be tested.)
Line 166: Line 166:
const limit = 1e5
const limit = 1e5
var results []int
var results []int
for i := 3; i < limit; i++ {
for i := 2; i * i < limit; i++ {
n := countDivisors(i)
n := countDivisors(i * i)
if n > 2 && rcu.IsPrime(n) {
if n > 2 && rcu.IsPrime(n) {
results = append(results, i)
results = append(results, i * i)
}
}
}
}