This is a quiz from Brilliant.org Algebra Fundamentals courses.
Quiz:
At Step 40, how many cats will there be in the 7th row?
Answer: 14
Explanation given by Brilliant.org is not clear to me so if someone can give a better explanation it will be helpful.
Explanation by Brilliant.org
In rows where dividing by 3 has a remainder of 1, the pattern is cat-rabbit-dog.
7 when divided by 3 has a remainder of 1, so cats occur at 1, 4, 7, etc., i.e. at points where dividing by 3 has a remainder of 1.
In step 40, the grid is 40 columns wide. The full cat-rabbit-dog pattern happens for $39\div 3=13$ times, but since the pattern at row 7 starts with a cat, column 40 has one extra cat. So there are $13 + 1 = 14$ cats.
Note: A more compact way of saying "dividing $x$ by 3 has a remainder of 1" is $x \mod 3 = 1$.
By reading all the answers I able to understand more and here is my simple explanation.