Improved performance of infinite sequence search and implemented limiting infinite sequence by min and max