Function created to generate a list up to a certain number, useful for testing