Finding greatest number in a sequence