Friday, March 19, 2010

[hyyriekn] Perl numbers and letters

Perl's magic ++ operator works on letters as well as numbers.  But it is not exactly base 26 because "a" is distinct from "aa" (not so for decimal 0 and 00).  Assuming "a" is zero, write functions converting from letters to decimal numbers and vice versa.  This should be easy.

(x^n-1)/(x-1) might be useful.

No comments :