Sum of square and cube digits of an integer are primes: Difference between revisions
Sum of square and cube digits of an integer are primes (view source)
Revision as of 10:17, 6 February 2022
, 2 years agoAdded Go
Catskill549 (talk | contribs) (added AWK) |
(Added Go) |
||
Line 317:
next n</lang>
{{out}}<pre>16 17 25 28 34 37 47 52 64</pre>
=={{header|Go}}==
{{libheader|Go-rcu}}
<lang go>package main
import (
"fmt"
"rcu"
)
func main() {
for i := 1; i < 100; i++ {
if !rcu.IsPrime(rcu.DigitSum(i*i, 10)) {
continue
}
if rcu.IsPrime(rcu.DigitSum(i*i*i, 10)) {
fmt.Printf("%d ", i)
}
}
fmt.Println()
}</lang>
{{out}}
<pre>
16 17 25 28 34 37 47 52 64
</pre>
=={{header|Haskell}}==
|