How to do this? Arrays and math
This is probably something simple, but know hardly any C++.
What I need to do is:
I have an __int64 N (a 64 bit integer) that is set equal to a number. I want to mod (%) N with each number in this array:
unsigned const long primetable[] =
{
3, 5, 7, 11, 13, 17, 19, 23,
29, 31, 37, 41, 43, 47, 53, 59, 61
};
it starts with the first one, then loops to the next... and stops modding before the CURRENT NUMBER in the array gets greater than:
(long)sqrt(N)
I also have to be able to test each mod to see if the result is zero. It needs to be some kind of for-loop.
Oh, also-- The array I have above isn't the complete one. The actual one is extremely long and contains thousands of separate numbers.
What's stopping me is a lack of knowledge of the syntax, or anything about arrays or array manipulation. Any help would be great! Thanks.