Square-free integers: Difference between revisions

Line 887:
<lang julia>using Primes
 
const maxrootprime = Int64(floor(sqrt(BigInt(1000000000145))))
sqprimes = map(x -> BigInt(x) * x, primes(2, maxrootprime))
possdivisorsfor(n) = vcat(filter(x -> x <= n / 2, sqprimes), n in sqprimes ? n : [])
issquarefree(n) = all(x -> floor(n / x) != n / x, possdivisorsfor(n))
4,108

edits