4, 7, 3, 4,….
In the sequence above, the first term is 4, the second term is 7, and each term after the second term is the nonnegative difference between the previous two terms. If the nth term is the first term of the sequence that is equal to zero, what is the value of n?

Okay I know this number can be solved through first principles(finding each number in the sequence manually) but I can’t help but wonder if there’s a certain algebraic formula or method one can utilize to solve it.


I’m sure I’ll get notation wrong since I’m just shooting from the hip here, but the terms can be represented algebraically like this. For terms x_1through x_n, where n>2:
x_1=4, x_2=7, x_n=|x_{n-1}-x{n-2}|.

But even once I’ve got the above, I’d still rather just list out terms until I get a zero than try to figure out how to program my calculator to iterate that. (This is cake with a spreadsheet, not that you can use one on whatever kind of test this is from…)