A sequence of non negative integers $u_n$ is defined by $u_1 = a, u_2 = b$ and $u_{n+2} = u_{n+1} + u_n$. How many pairs of non-negative integers $(a,b)$ are there such that $21$ is a term of the sequence with $a \not = 21$ and $b \not = 21$?
The solution to this question is 40, however I was hoping there was a quicker solution to the question other than brute force.
I tried brute force two ways, one was to enumerate values (a,b) and check them, this was quite slow even with some subtle clues: I worked out if $(a,a)$ was a solution then so was $(a,0)$ and $(0,a)$ and that if you write out a sequence for some $(a,b)$ that has $21$ in it, then all pairs before $21$ will work.
I also tried another brute force method where I observed the sequence went $a,b,a+b,a+2b,2a+3b,3a+5b,5a+8b,8a+13b,13a+21b,21a+34b$ and then went through the terms and found solutions to the equation, faster but still slow.
This question is from a math competition and suspect both are too slow, a third solution I thought of was finding the closed form but this method is still quite slow (and too advanced for the person I am helping)
Does anyone have a solution for this, that would be suitable in a maths competition? I'm sure this is some sort of trick but I can't see it.
Source of question: Senior Team Maths Challenge 2014/15 regional final
Thanks