List comprehension for 7x7 board
Since 7 is prime, the following pseudo code works, although it involves some “thinking around the corner”.

[(r,c) | r&lt;-[1..7], c&lt;-[1..7], r * c not in [1, 3, 5, 7, 21, 35, 49]]


A more straightforward way would be

(r /= 1 &amp;&amp; r /= 7 &amp;&amp; c /= 1 &amp;&amp; c /= 7) || even r || even c