I am having the following problem. Lets consider the alphabet. From A-Z there are 26 letters. If its for example AA, then its the 27 letter this goes on until for example AWZ which is the 1300 letter in this alphabet. One can visualize an excel spreadsheet for this alphabet(the columns). Lets consider we want to know the position of the the letter(column in excel) XX or BD. Is there any algorithm to calculate this without counting it?
I appreciate your answer!
PS.: Problem is not out of any book. Just asked the question myself, after I used excel ;P
$\boxed{\text{Val}(\alpha \beta) = 26\times\text{Val}(\alpha) + \text{Val}(\beta)}$
More generally:
$\boxed{\text{Val}(\alpha_n \alpha_{n-1} \ldots \alpha_0) = 26^{n-1} \times \text{Val}(\alpha_n) + 26^{n - 2} \times \text{Val}(\alpha_{n-1}) + \cdots + \text{Val}(\alpha_0)}$