Yes, an array would have been better if I wanted to go back later; however, I'm not sure what for. The only thing I'm coming up with is maybe to sort it, but if we're talking about lots of numbers, there's no reason to add something with an O(n^2) inefficiency. Yes, an array with the first x primes would be more efficient, I even have a program I made a while back that will compute them...or one could just d/l them...of course, if I actually stored them, that's several megabytes worth of stuff in the source that I wouldn't feel like uploading.
LOL, I didn't even realize that I was doing two i++ in there, now that I think about it logically, it actually makes sense to increment by two too, but because I don't have an i++ in the if, it kind of messes it up. Then again, if I really wanted I could just make the loop a massive recursive function; point being, never ask me to program anything for you...which you didn't.
by a dynamic base case (base case is the term used in recursive functions for what will cause it to be satisfied)* I mean it would terminate the loop iteration sooner depending on what number it's checking, but if you use a list of primes anyway it wouldn't do anything. Like if we have the number 100, I could check every value up to 33, but this condition of this would be satisfied by 3, same with checking ever number up to 50 which would be satisfied by 2. In this case it would stop at 2, divide the number and repeat using 50 as the new value, but for something that is a prime number, it would make no sense to keep going that high when we'd be sure there would be no solution.
*ie: if you had
int i=0;
increase(int x)
{
if x>0
{i++; increase(x);}
}
it would loop around forever because the base case being x>0, will never not be true until it got to (x^31)-1 whence it would crash due to the int being to large; or to really elaborate, it would prob turn into a negative number, weird how that seems to happen, in which case the method would do nothing
AND THIS PEOPLE, IS WHY WE NEED A SEPARATE PROGRAMMING GATEGORY