static string base10ToBase26(string s) { char[] allowedLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray(); decimal num = Convert.ToDecimal(s); int reminder = 0; char[] result = new char[s.ToString().Length + 1]; int j = 0; while ((num >= 26)) { reminder = Convert.ToInt32(num % 26); result[j] = allowedLetters[reminder]; num = (num - reminder) / 26; j += 1; } result[j] = allowedLetters[Convert.ToInt32(num)]; string returnNum = ""; for (int k = j; k >= 0; k -= 1) { returnNum += result[k]; } return returnNum; } static string base26ToBase10(string s) { string allowedLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; System.Numerics.BigInteger result = new System.Numerics.BigInteger(); for (int i = 0; i <= s.Length - 1; i += 1) { BigInteger pow = powof(26, (s.Length - i - 1)); result = result + allowedLetters.IndexOf(s.Substring(i, 1)) * pow; } return result.ToString(); } static BigInteger powof(int x, int y) { BigInteger newNum = 1; if (y == 0) { return 1; } else if (y == 1) { return x; } else { for (int i = 0; i <= y - 1; i++) { newNum = newNum * x; } return newNum; } } static int modulo(long _num, long _base) { return (int)(_num - _base * Convert.ToInt64(Math.Floor((decimal)_num / (decimal)_base))); }