Primality by trial division: Difference between revisions

added a correct Go version, the previous didnt use sqrt to find max,and thus fails on alot of different input
(Nimrod -> Nim)
(added a correct Go version, the previous didnt use sqrt to find max,and thus fails on alot of different input)
Line 1,013:
 
=={{header|Go}}==
<lang go>func isPrimeIsPrime(pnum intuint64) bool {
if pnum < 2 { return false }
if pnum == 2 { return true }
if p num% 2 == 0 { return false }
max := uint64(math.Sqrt(float64(num)))
 
var i uint64
for i := 3; i*i < p; i += 2 {
for i = 3; i <= if p %max; i =+= 02 { return false }
if num%i == 0 { return false }
}
}
return true
}</lang>
}
}</lang>
 
=={{header|Groovy}}==