Hoffstadter's Q sequence
I am trying to understand Hoffstadter's Q sequence. I am suppose write a program that runs an equation that takes a positve integer from user input and outputs its corresponding Q sequence number. With a sample input of "5". The equation is "Q(n - Q(n - 1))+ Q(n - Q(n - 2))". The sample answer is "3". It is explained as: Q(5 - Q(5 - 1))+ Q(5 - Q(5 - 2)) becomes Q(5 - Q(4))+ Q(5 - Q(3)) and then Q(5 - 3) + Q(5 - 2) and then Q(2) + Q(3) and finally, 1 + 2 = 3. Can anyone explain how Q(4) = 3, Q(3) = 2. If someone if write out how to get the numbers the sample out produced with this sequence, that would be great. Not asking for solution to the programming issue, but an explanation how the numbers mentioned are obtained. I startted running the Q numbers through formula but its like "what came first, the chicken or the egg". Much appreciated if anyone can help!