Artificial intelligent assistant

Solving the "Eric the Sheep" problem I've been puzzling over this problem for a bit. I found it on learner.org. It says, "It's a hot summer day, and Eric the Sheep is at the end of a line of sheep waiting to be shorn. There are 50 sheep in front of him. Being an impatient sort of sheep, though, every time the shearer takes a sheep from the front of the line to be shorn, Eric sneaks up two places in line. Without working out the entire problem, predict how many sheep will get shorn before Eric."

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

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy d7d7c95e29f94bb20f7198e946839374