I am dealing with very large numbers. One of my algorithms requires a number 'x' to be smaller than another number 'n', in order to perform that algorithm. I was wondering is it possible to encrypt the very large number to produce a smaller number and store the key for when I need to decrpyt the number back to a larger number? I have looked at mcrypt but that doesnt output all numbers, from what I have seen it outputs a string.
What you're talking about is called "compression", not "encryption".
If anything, encryption is likely to yield a larger string than its input. While you may be able to compress the number, it will be very slight savings.
Depending on the range of possible values, you may be able to simply build an array of every possible large number and work with array indexes instead of the numbers themselves.