Given a arithmetic sequence in the form $s(n)=an+b$, and a simple quadratic equation in the form $q(n) = n^2+d$ (however, $q(n)=an^2+bn+c$ would be ideal), find the resulting quadratic sequence of the common values between the terms. So far, I have figured out that the resulting sequence there may be multiple interleaved quadratics.
For example (starting from n = 1),
$s(n)=3n+1$; values: $4, 7, 10, 13, 16, 19, 22, 25, ..., 49, ..., 64, ...$
$q(n)=n^2$; values: $1, 4, 9, 16, 25, 36, 49, 64, ...$
the resulting sequence is $4, 16, 25, 49, 64, 100, 121, 169, 196, ...$
In this particular example, the sequence is defined by two quadratic sequences that are interleaved: $(3n-1)^2$ (odd terms) and $(3n+1)^2$(even terms)
How can a common-value sequence be constructed from the common values of a arithmetic and quadratic sequence?
I cannot seem to find a pattern by examples, and cannot think of a way to analytically approach the problem. I also cannot find any resources on the internet relating to the problem (however, my keyword game may just be weak).
Thanks in advance for any help or pointers