generate numbers sequentially to reduce memory usage