Nice primes: Difference between revisions

Content added Content deleted
(Added Go)
(→‎{{header|Wren}}: Simplification.)
Line 210: Line 210:
}
}


var smallPrimes = [2, 3, 5, 7]
System.print("Nice primes in the interval (500, 900) are:")
System.print("Nice primes in the interval (500, 900) are:")
var c = 0
var c = 0
Line 217: Line 216:
var s = i
var s = i
while (s >= 10) s = sumDigits.call(s)
while (s >= 10) s = sumDigits.call(s)
if (smallPrimes.contains(s)) {
if (Int.isPrime(s)) {
c = c + 1
c = c + 1
Fmt.print("$2d: $d -> Σ = $d", c, i, s)
Fmt.print("$2d: $d -> Σ = $d", c, i, s)