I haven't found this particular sequence in the OEIS. Perhaps a similar sequence is there with different starting values? a(1)= a(2)= 1 a(n)= ( a(n-1) + a(n-2) ) mod (n- a(n-1) ), where mod indicates that the least non-negative residue be taken. I get 1, 1, 0, 1, 1, 2, 3, 0,.... for n= 1, 2, 3,...