Sequences, sets and element position in the set. I have a sequence Q with the length of N.
This is the fragment of this sequence:
68 70 72 74 76 78 80
The sequence has been divided into the sets of 4 elements each.
I know the first element of the set. And i need find position of the given element in the set:
For example: let take the set: 60 62 64 66,
I know that the first element is 60, then i was given element 64 and i need to find its position in the set. 
This is simple: 
A(n) = A + (n - 1)*2 -> 64 = 60 + (n-1)*d thus n = 3
I have found the position of the given element in the current set.
Now the hardest part! The sequence Q is still divided onto sets of 4, BUT it gets reset every 40 items:
74 76 78 80 82 42 44 46 48 50 52 54 56
How would i find the position of the given element in the set of 4 in this case?
Any ideas?
P.S. this is a real life problem i need to solve to finish my programming task :)
EDIT
I also know the N (length of the sequence Q)
EDIT
Sequence can start with any even number
 A: I don't know what do you mean by "The sequence gets reset every $40$ items", so I assume that $Q$ is like $$P,P+2,P+4,P+6, \ldots ,P+2(M-1),P,P+2,P+4, \ldots $$ where $P=$ starting even number and $M=$the number of items of $Q$ between $2$ starting numbers, so the greatest number in the sequence will be $P+2(M-1)$.
Let $A$ be the first element of the $4$-item set (which is known), and $X$ the element, whose position $p_X$ is unknown. Then you have 
\begin{cases}
X > A \Rightarrow p_X= \frac{X-A}{2}+1 \\
X < A \Rightarrow p_X= \frac{2M+X-A}{2}+1 \\
\end{cases}
More generally speaking if we wish to know the formula for $p_X$ in a increasing sequence or in a decreasing sequence, let $\mu = \pm 1$ depending whether the sequence is increasing or decreasing; in particular $\mu = +1$ if we consider an increasing sequence and $\mu = -1$ when we manage a decreasing sequence $\ldots$ then the general formula will be:
\begin{cases}
\mu X > \mu A \Rightarrow p_X= \frac{\mu (X-A)}{2}+1 \\
\mu X < \mu A \Rightarrow p_X= \frac{\mu (X-A)+2M}{2}+1 \\
\end{cases}
