Exploring Tail Recursion

Here is a math puzzle that is explored in this post:Find the smallest positive integer n such that n % x = x-1 for x from 2 to 18i.e. The remainder is one less than the divisor for all integral divisors from 2 to 18.

I discovered this the hard way and so I had switch to iteration in Ruby and Java. I am not 100% sure if my Erlang solution is indeed tail recursive (the if statement ends after the last function call) but it does run noticeably faster than the others. I am a novice Ruby and Erlang coder, all code improvement suggestions will be gratefully accepted (expect for ones that call out for hard coding/error handling/better names, this is a puzzle dammit.)