using a recursive implementation to get current sequence number