Say we are given $f(m,n)=m \pm 2n + (-1)^n$ where $m>0, n>0$, $m$ as well as $n$ are integers. The problem is to generate a list of all the integers that will not be found in the list of values of the function $f$ for a particular $m$ and $n$.
I came up with the code for the 'plus' sign as
"Complement[Table[i,{i,1,20}], Flatten[Table[$m+2n + (-1)^n$, {n, 4}, {m, 2}], 1]]" - - - (a)
and the 'minus'sign as
"Complement[Table[i,{i,1,20}], Flatten[Table[$m-2n + (-1)^n$, {n, 4}, {m, 2}], 1]]" - - - (b)
After which I now executed
"Intersection[a,b]"
This gave me the result i wanted though it is highly inefficient because as $m$, $n$ increases, the codes take much time. I need $m$, $n$ up to about $10^9$.
I want an efficient code that will be executed once.
Thanks in advance.