function to recognize generation numbers