#!/usr/bin/perl -w # a not too bad approximation to the number of primes # less than N is approximately N/log(N). Better methods # exist, but none are as simple... my $n1 = 10**8; my $n2 = 2**32; $\="\n"; # ~ 5428681 print "Number of primes less than $n1 is ",int($n1/log($n1)); # ~ 193635250 print "Number of primes less than $n2 is ",int($n2/log($n2));
In reply to Re^2: Simple primality testing
by Anonymous Monk
in thread Simple primality testing
by ambrus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |