1. ## Heres my problem. I completed a sieve originally that did not include sqrt or dividing just by odd numbers other then 2. But when I used it, it was too slow for the really big numbers so, I was told that in order to fix it the best thing to do was to just use the sqrt of the the original number and to only divide by 2 and odd numbers. However when I went to implement this it has not worked so well and Im at a loss, to know how to fix it.
Heres the the part of the codes thats the problem. The user inputs the range of numbers of course the sieve finds the primes within the range. The only specifications of the range is that of course its positive and that the end is larger then the beginning.

void getPrime(int start, int end)
{
int numbs;
int numprimes;
int num1 = START;
int num2 = START;
int num3 = START;

for (start = sqrt(start); start <= end; start++)
{
numbs = START;
for (numprimes = 3; numprimes < sqrt(start); numprimes += 2)
{
if(start % 2 == START)
{
numbs = numbs + 1;
}
else if(start % numprimes == START) // Not a prime if yes
{
numbs = numbs + 1;
}
if((numbs == START)) // prime if yes
{
if( start >= 2)
{
num3 = num2;
num2 = num1;
num1 = start;

if(num3 == START && num2 == START)
{}
else if (num3 == START)
{
printf("Prime numbers:\n\n");
printf("%d\n", num2);
}
else if (((num1 + num3) / AVG) == num2)
{
printf("%d is a balanced prime.\n", num2);
}
else if (((num1 + num3) / AVG) > num2)
{
printf("%d is a weak prime.\n", num2);
}
else if(((num1 + num3) / AVG) < num2)
{
printf("%d is a strong prime.\n", num2);
}
}
}
printf("%d\n", num1);
return;
}
Right now this is printing only part of the primes and the primes it is printing, its printing multiple times.

my bad START = 0 and AVG = 2 for clarification. 2. 3. Originally Posted by guy who is afraid of code tags
I completed a sieve originally that did not include sqrt or dividing just by odd numbers other then 2
I loled.

Quzah. Popular pages Recent additions prime, sieve 