convert number to combination of letters
问题 I need to convert a number between 1 and 6000000 to a letter combination like ABCDE. Less letters is better. but i'm guessing i will need 4 or 5. Can someone point me in the right direction as how to write an algorithm to convert numbers to letters and back? only A-Z. (caps). 回答1: You need to convert to base-26 numbering: 0 is A, 1 is B, 25 is Z, 26 is BA, etc. The Hexavigesimal Wikipedia article has code for conversion to base 26. 回答2: There are 26 letters in the alphabet. TYou have 26^4 < 6