For every sheep shorn, Eric's place in line jumps forward exactly two places. So, when one sheep is removed from the line, Eric's place in line moves up one, then two, so three.
Let:
n = the number of sheep shorn
a_n = the number of sheep in front of Eric. (This is just sequence notation; you can think of it as a function a of n.) For one sheep,
a_1 = (51 - 3)
For two,
a_2 = (51 - 3) - 3 = a_1 - 3
For three,
a_3 = ((51 - 3) - 3) - 3 = a_2 - 3
For four,
a_4 = (((51 - 3) - 3) - 3) - 3 = a_2 - 3
So for any n,
a_n = a_(n-1) - 3 = 51 - 3n
Our goal in the above problem is to find the value of n that makes a_n = 0.
Therefore,
0 = 51 - 3n
51 = 3n
51/3 = 3n/3
17 = n