mirror of
https://github.com/cubixle/codekata-golang.git
synced 2026-04-30 11:38:42 +01:00
51: prime digit replacements
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"math"
|
||||
)
|
||||
|
||||
func main() {
|
||||
}
|
||||
|
||||
func isPrime(n int) bool {
|
||||
res := int(math.Sqrt(float64(n)))
|
||||
divider := 2
|
||||
for divider <= res {
|
||||
if n%divider == 0 {
|
||||
return false
|
||||
}
|
||||
divider++
|
||||
}
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user