Need help with the logic for ksh script

Hi guys
I am having hard time to figure out the logic for the following problem:

I have a line of sorted numbers , for example 19 34 44 49 64
I am trying to find the way to determine which two numbers are in between the number I have specified.

for example if 34 is specified 19 and 44 should be returned.

Thanks a lot for any help and ideas

Double posting (see here) , thread closed.