How to determine the missing term in a number sequence