I’m trying to make afunction that gets the first pair of prime numbers within a gap.
I started by creating a vector and setting the size of it to the difference between ‘m’ and ‘n’.
However i leeep runing into this problem. The first element of the vector is always ‘0’ when it should be (in this example) 3 (and the last number 7).
//declare variables
int gap = g;// 0 for now
int lowLimit = m;//3
int highLimit = n;//7
//vector with all the numbers
vector<int>nums(n - m);
//fill nums with all he numbers between n & m inclusive
int numsToSearch = n - m;
for (int i = m; i <= n; ++i) {
nums.push_back(i);
std::cout << "first for: " << nums.at(i) << 'n';
}
5