Pyth, 49 48 46 44 bytes
_s.b@+kNsYc3mC+913d-.iU25smXm17hT4Cd"KGO"17_
Try it here.
Still working on shortening the function to generate the alphabet... and yes, the generator is longer than hardcoding the alphabet by 4 characters, but not in bytes.
_s.b@+kNsYc3[...]_
_ get input (implicit) and reverse
[...] generate "ΑΒΓΔΕϜΖΗΘΙΚΛΜΝΞΟΠϘΡΣΤΥΦΧΨΩϠ" (see below)
c3 split into 3 equal chunks
.b map over each input digit (as Y) and chunk (as N)...
+kN prepend empty string to N (to support digits of 0)
@ sY get the Yth element of the empty-string-plus-digits array
s concatenate all the digits
_ reverse again to put digits back in the right order
Here's how the alphabet-generating function works. Let's take all the codepoints and subtract 913 (the smallest value):
0 1 2 3 4 75 5 6 7 8 9 10 11 12 13 14 15 71 16 18 19 20 21 22 23 24 79
Now let's pull out the ones that don't fit the pattern:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 18 19 20 21 22 23 24
75 71 79
Okay, so the strategy is forming: generate the range 0 to 24 (we'll deal with the missing 17 later), and then insert 75, 71, and 79 at the correct locations.
How can we insert the outliers? Pyth has an .i
nterleave function that takes ex. [1,2,3]
and [4,5,6]
and results in [1,4,2,5,3,6]
. We're going to have to add some placeholders, though, since obviously the outliers are far apart. Let's represent the placeholder with X:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 18 19 20 21 22 23 24
X X X X 75 X X X X X X X X X X 71 X X X X X X X 79
Right, so the bottom outlier array starts with four X
s. Can we group the outliers to each be preceded by four X
s and see what remains?
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 18 19 20 21 22 23 24
[four X]75 X X X X X X [ four X ]71 X X X [ four X ]79
Now we make another key observation: since 79 comes at the very end, there can be any number of X
s preceding it, and any number of X
s following it as well! This is because interleaving [1,2,3]
and [4,5,6,7,8,9]
results in [1,4,2,5,3,6,7,8,9]
—note that the extra elements in the second array end up at the end, and since they're going to be removed anyway, we can safely allow that.
That means we can normalize this such that every outlier is preceding by four X
s and succeeded by 6:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 18 19 20 21 22 23 24
[four X]75[ six X ] [ four X ]71[ six X ] [four X]79[six X]
Great! Now we can simply take the array [75, 71, 79]
, insert four placeholder values before each element and six after, and then interleave it with the range 0..24
.
But wait, what happened to 17
? Remember, the top line in all of these examples has been missing 17. We can simply remove the 17 after interleaving; but this leaves another delightfully evil possibility open. You guessed it—the placeholder value we've been referring to as X
will be 17. This allows us to remove both the extraneous 17 and all the placeholder values in one fell swoop.
Finally! Here's the code used to implement this:
mC+913d-.iU25smXm17hT4Cd"KGO"17
m "KGO" for each char in the string "KGO"...
Cd take its ASCII value ("KGO" -> 75,71,79)
m17hT generate an 11-element array filled with 17
X 4 replace the 5th element with the ASCII value ^^
s concatenate all of these together
.iU25 interleave with range(25)
- 17 remove all the 17s
m d for each value in the resulting array...
+913 add 913 (to get the real character value)
C convert to character
Does that include base 10 number conversion? – Neil – 2016-04-22T00:34:10.767
2I might be misunderstanding, but shouldn't
123
be "PKΓ" – Maltysen – 2016-04-22T01:03:49.6203You may want to add test cases such as
700
and803
(with zeroes as digits). – Doorknob – 2016-04-22T01:16:47.877How does 123 start with
Tau
? Doesn'tTau
mean 300, and thereforeTauKappaGamma
means 323? – R. Kap – 2016-04-22T01:32:31.0571
what encodings are allowed for the greek letters? UTF 8? (please give codepoints.) Are codepages allowed, such as https://en.wikipedia.org/wiki/Code_page_737 ? it may be obsolete but greek letters are rendered with a single byte.
– Level River St – 2016-04-22T01:39:41.523@LevelRiverSt Any encoding is fine, but codepoints are UTF-8. – NoOneIsHere – 2016-04-22T01:50:48.837
2The character codes don't check out for me. 930 appears to be ; 931 is Σ. – Dennis – 2016-04-22T03:14:51.873
The char code skip is because, in the lower-case section of ISO-8859-7, the final sigma precedes the regular sigma; there is no uppercase final sigma, so there is no respective code point. – Conor O'Brien – 2016-04-22T12:49:57.460