I have been making a prime number generator.

It works, but it's considerably slow if a user enters a high number. If anyone has any suggestions on how to make it faster, please post it.

Here's the genrator code:

```
unsigned long int theNumber;
unsigned long int Factor1 = 1, Factor2 = 1;
//-----------Find the prime number-----------------
do
{
Factor2 = 1;
Factor1 += 1;
if (Factor1 * Factor2 != theNumber)
{
isPrime = FALSE;
} // End if
else
{
isPrime = TRUE;
} // End else
while (Factor1 < (theNumber / 2) + 1 && Factor2 < theNumber && Factor1 * Factor2 != theNumber)
{
Factor2++;
if (Factor1 * Factor2 != theNumber)
{
isPrime = FALSE;
} // End if
else
{
isPrime = TRUE;
} // End else
} // End while
} while (Factor1 * Factor2 != theNumber); // End do
//-------------------Done finding------------------
// Display the results
switch (isPrime)
{
case TRUE:
cout << "\n Hurray! It's a Prime Number!";
break;
case FALSE:
cout << "\n Sorry, It's Not a Prime Number.\nThe two factors we found were: " << Factor1 << " and " << Factor2 << ".";
break;
} // End switch
```