2004 AIME II Problem 9

A sequence of positive integers with a_{1}=1 and a_{9}+a_{10}=646 is formed so that the first three terms are in geometric progression, the second, third, and fourth terms are in arithmetic progression, and, in general, for all n \geq 1, the terms a_{2 n-1}, a_{2 n}, and a_{2 n+1} are in geometric progression, and the terms a_{2 n}, a_{2 n+1}, and a_{2 n+2} are in arithmetic progression. Let a_{n} be the greatest term in this sequence that is less than 1000 . Find n+a_{n}.