A: 1,1,1,1,1,1,1,...

B: 1,2,3,4,5,6,7,...

or

A: 1,2,1,2,1,2,1,2,...

B: 1,1,2,2,3,3,4,4,...

or

A: 1,2,3,1,2,3,1,2,3,...

B: 1,1,1,2,2,2,3,3,3,...

etc.

The goal is to derive a third value C that will simply be integer values from 1, 1,2,3,4,..., in each case.

I am looking for a simple algorithm to get C whatever the values of A and B might be.

I have concocted an answer, but it looks overly-complex and inelegant to me, I think there is a better solution out there.