Skip to content

Instantly share code, notes, and snippets.

@dfilimon
Created February 3, 2013 22:52
Show Gist options
  • Save dfilimon/4704091 to your computer and use it in GitHub Desktop.
Save dfilimon/4704091 to your computer and use it in GitHub Desktop.
Number of primes less or equal to n vs n
library('gmp')
primes <- data.frame(1:1000000)
names(primes) <- 'nums'
primes$isprime <- isprime(primes$nums)
pn <- primes[primes$isprime == 2, 'nums']
e <- ecdf(pn)
plot(e, xlab='n', ylab='Number of primes less or equal to n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment