Problem 61066. Convert Decimal to Hexavigesimal
NASA (Ned’s Alien-Spying Agency) have made contact with a 13-fingered race from the planet Genai. Naturally, Ned’s shadowy operatives intend to communicate with the aliens via the universal language of mathematics. However, because of their digitally prodigious physiology, the Genaians use a base-26 number system. This is convenient for humans with an English keyboard, because base-26 can be represented with the letters of the English alphabet: 'a' = 0, 'b' = 1, …, 'z' = 25.
Given an integer-valued numeric scalar, return the char vector of the characters 'a'-'z' that represents the value in base 26, treating each character as a digit.
Return the shortest char vector possible (that is, do not include any leading 'a's). So, an input of 25 should return 'z'; an input of 26 should return 'ba'. The value 202982 should return 'loha', not 'aloha' or 'aaloha'.
Examples
h = num2char26(1208856210289)
h = 'funfunfun'
h = num2char26(142917893)
h = 'matlab'
h = num2char26(228956)
h = 'nasa'
Assumptions
Ned is planning to start with basic whole numbers, so the input will be a scalar double with an integer value. Concepts like public-key encryption aren't on the agenda yet, so the input values will all be small enough to be exactly representable in double precision.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers56
Suggested Problems
-
Convert Decimal to Hexavigesimal
56 Solvers
More from this Author33
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!