That's cool Carl, thanks. Now here's the one I was really after, just wanted to know how to keep and compare terms. I doubt a formula would work here but would like to be proved wrong:
a(0)=a(1)=0. a(n+1) = index of the last term k = a(n), if that value has appeared before; else a(n+1) = a(a(n)-1).
0,0,0,1,0,2,0,4,1,3,0,6,2,5,0,10,3,9,1,8,4,7,0...... Terms and indices read backwards between any pair of 0s generate the forward string of terms between the next but one pair of 0s.
Recursive, self generating self referencing sequence.
Terms enter the sequence first as indices of previous terms (see rule); Subsequence: 0,1,2,4,3,6,5,10..... the one you already know.
Then they re enter, repeatedly; (see rule); Subsequence: 0,0,1,0,2,0,3,1,1,4,0..... By prepending a zero to this, and rotating terms betwen 0s, the original sequence re appears........