One of the above is likely to work with any shell that is based on Bourne shell syntax. I make no claims about how to do this with a shell based on csh syntax.
I doubt that it is working for all numbers below 99. And, you haven't told us what shell you're using to get these results. The above output is exactly what I would expect if you're using bash as your shell. As I explained in post #4 in this thread, bash treats 0120 (an octal number) as 80 (decimal).
I don't think this is available in bash, which is a little frustrating because it is so easy, however I'm sure there is a good reason. I have use this sort of thing frequently, so it would be know if there is a danger with it, hence why it has not made it into bash. If there is a neat way like this, I'd love to know it!