primeFactors(1002001) # 7 7 11 11 13 13
primeFactors(65537) # is prime
# Euler's calculation
primeFactors(2^32 + 1) # 641 6700417
radical(1002001) # 1001
if (FALSE) {
for (i in 1:99) {
for (j in (i+1):100) {
if (coprime(i, j)) {
k = i + j
r = radical(i*j*k)
q = log(k) / log(r) # 'quality' of the triple
if (q > 1)
cat(q, ":\t", i, ",", j, ",", k, "\n")
}
}
}}
Run the code above in your browser using DataLab