I don't know the proper mathematical expression for for-loops, especially those that carry two distinctly behaving variables with each iteration.
For example, assuming n
is previously defined and holds some positive integer, how I would I represent the set printed by this for-loop in mathematical notation?
// prints a set of multiples (n previously defined)
for (int j=n, k=n; k>=0; j++, k--) {
cout << (n-j)*(n-k) << endl;
}
Forgive my crudeness, but I'm thinking something along the lines of:
$\left \{ \left ( n-j \right ) \cdot \left ( n-k \right )\forall j \left \{ n, n+1, ..., 2n \right \} \forall k \left \{ n, n-1, ..., 0 \right \}\right \}$
I'm lost. Should I even be using $\forall$ in this context? Any guidance is greatly appreciated!