num <- 1:2000000
prime <- rep("Prime", 2000000)
divisor <- rep(0, 2000000)
for (x in seq(from=2, to=2000000, by=1)) {
z <- sqrt(x);
for (y in 2:z) {
if (x%%y == 0) {
prime[x] <- "Non-Prime";
divisor[x] <- y;
break;
}
}
}
ptable <- table(prime)
prop.table(ptable)
No comments:
Post a Comment