Pyxplot

Examples - Density of primes


Prev
Next

Download this example:

Example plot - the density of prime numbers

This plot illustrates the prime number theorem, which states that the density of prime numbers approximately follows the expression 1/ln(N).

Script


# Make temporary datafile listing prime numbers
set samp 10200
set output 'temp.dat'
tabulate [1:10200] x*prime(x)

histogram f() 'temp.dat' using 2 binwidth 100
set output 'output.eps'
set samples 1000
set width 8
plot [5:10000][0.05:0.25] f(x), 1/ln(x)