Books: The First 100,000 Prime Numbers
U >>
Unknown >> The First 100,000 Prime NumbersThe First 100,000 Prime Numbers
This file contains the first 100,000 primes as well as the C program
(frightfully primitive as it may be) which is used to calculate them.
They were calculated at using a Cray X-MP.
***Program Begins***
#include "stdio.h"
#include "math.h"
int number;
main()
{
printf("Which number do you wish to start the test with? ");
scanf("%d",&number);
printf("\n");
printf("I'm starting with number %d\n",number);
if (number<1) number=1;
if (number==1) printf("1\n");
if (number<=2) printf("2\n");
if (!(number % 2)) number++;
if (number==1) number=3;
do
{
if (isprime(number)) printf("%d\n",number);
number+=2;
}while (1) ;
}
isprime(int thenumber)
{
int isitprime=1,loop;
for(loop=3 ; (isitprime) && (loop<(sqrt(thenumber)+1)) ; loop+=2)
isitprime = (thenumber % loop);
return(isitprime);
}
***Program Ends***