I say stop trying to figure out how to "invert" that function and just write the calculation. If int digits; holds the digits of a 5 digit number then the N you are looking for is: int N = digits + 10*digits + 100*digits + ...
Just put that in a loop.
@Athar: Hope you don't mind me stepping in here.
Question for you. The meaning of big-endian vs. little-endian in a number representation.
I have chosen big-endian above because I am storing the most significant digit last, correct?
The endianness is named for what is in element 0 then, not the last element?
I store the least significant digit (the little one) in digits, so it is little-endian?
I see, by refering to OP's OP (original post), that he is indeed assigning the ones digit to array on the 1st iteration, so it would be big-endian.
I was confused because I thought the "end" in "endian" referred the "end" of the array, not the beginning.