Program: RMprime.z80
This program prompts the user for a number and then generates prime numbers up to that number.
At the end, the ratio of the first number to the number of primes found is displayed, along with the natural logarithm of the first number. The prime number theorem says these are approximately equal although you can see there is a difference of about 1 in the case above, Having looked at a table of primes, I can see the difference is still about 1 for the 1000th prime.
Up to 255 primes can be found. This is defined by the variable max, which can be changed.
Originally, the program checked for odd factors to decide if a program was a prime, which was very inefficient! I've changed it to store prime numbers as they are found and to search just those instead (from 3 up) and it is much quicker now.