i wil lbe very great ful if u tell me how to use the algorithm . here are the two algorithms:-

Code: Select all

```
#include<stdlib.h>
#include<malloc.h>
#define isprime(f,x) (*(f+(x)/16)&(1<<(((x)%16L)/2)))
#define setprime(f,x) *(f+(x)/16)|=1<<(((x)%16L)/2)
void main()
{
unsigned char *field=NULL,*zzz;
unsigned long teste=1,max,mom,count,alloc;
int d;
max=20010000L;
while(field==NULL)
zzz=field=(unsigned char*) malloc(alloc=(((max-=10000L)>>4)+1L));
for (count=0;count<alloc;count++)
*zzz++ = 0x00;
while((teste+=2)<max)
if(!isprime(field,teste))
for(mom=3L*teste;mom<max;mom+=teste<<1)
setprime(field,mom);
if(isprime(field,3)==1)
/*now you can cll the module isprime to check any positive integer
either prime or not;
syntax:
isprime(field,integer);
if the module return 0 the integer will be prime
else not prime.
you can check upto 20000000 within a while
*/
free (field);
}
/*MY QUESTION*/
what should i use as a parameter in place of "field" is calling the function
isPrime(field,integer). that means if i want to calculate the primality of the number 100010041, how should i call the function isPrime(field?????,100010041)?????????????????????
/*********SIEVE*********/
#define MAXSIEVE 100000000 // All prime numbers up to this
#define MAXSIEVEHALF (MAXSIEVE/2)
#define MAXSQRT 5000 // sqrt(MAXSIEVE)/2
char a[MAXSIEVE/16+2];
#define isprime(n) (a[(n)>>4]&(1<<(((n)>>1)&7))) // Works when n is odd
int i,j;
memset(a,255,sizeof(a));
a[0]=0xFE;
for(i=1;i<MAXSQRT;i++)
if (a[i>>3]&(1<<(i&7)))
for(j=i+i+i+1;j<MAXSIEVEHALF;j+=i+i+1)
a[j>>3]&=~(1<<(j&7));
```

pliiiiiiiiiiiiiiiiiz help me

Bye

Riyad