[Question]
  [
Write a program or function which, given a positive integer as input, outputs the representation of that integer in [Maya numerals](https://en.wikipedia.org/wiki/Maya_numerals).
# Maya numerals
Maya numerals is a [vigesimal](https://en.wikipedia.org/wiki/Vigesimal) system (base 20) using only 3 symbols :
* `< >` for *Zero* (The correct symbol is some sort of shell that can't easily be represented using ASCII).
* `.` for *One*
* `----` for *Five*
Numbers are written vertically in powers of 20, and numbers between 0 and 19 are written as stacks of *fives* and *ones*. You shall refer to the [Wikipedia article](https://en.wikipedia.org/wiki/Maya_numerals) for more details.
As an example, here are the numbers between 0 and 25, separated by commas:
```
                                                                                 .    ..  ...  ....
                                                        .    ..  ...  .... ---- ---- ---- ---- ----  .    .    .    .    .    .
                               .    ..  ...  .... ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
<  >, .  , .. ,... ,....,----,----,----,----,----,----,----,----,----,----,----,----,----,----,----,<  >, .  , .. ,... ,....,----
```
# Inputs
* Inputs always are positive integers between 0 and 2147483647 (2^31 - 1).
* You may take the input from STDIN, as a command line argument, function parameter or anything similar.
# Outputs
* Each line is at most 4 characters long. `< >` and `----` should always be printed as given here (4 characters long each).
* Ones(`.`) must be centered on the line. If there are 1 or 3 `.`, since perfect horizontal alignment is impossible, it does not matter whether they are one column to the left or one column to the right or the center.
* There must be exactly one empty line between different powers of 20, regardless of the height of the stacks in the power of 20s. For example, the correct output for 25 and 30 are :
```
        .
 .
       ----
----   ----
```
* No leading or trailing lines allowed.
* Outputs must be printed exactly like they are in the examples given.
### Test cases
* Each individual number between 0 and 25 given as example above.
* Input: `42`
Output:
```
 .. 
 .. 
```
* Input: `8000`
Output:
```
 .  
<  >
<  >
<  >
```
* Input: `8080`
Output:
```
 .  
<  >
....
<  >
```
* input: `123456789`
Output:
```
 .  
... 
----
----
----
 .  
----
----
 .. 
----
----
 .  
....
----
----
----
....
----
```
* Input: `31415`
Output:
```
... 
... 
----
----
----
----
----
----
----
----
```
* Input: `2147483647`
Output:
```
 .  
... 
----
----
 .  
----
----
 .  
----
----
----
....
----
 .. 
 .. 
----
```
# Scoring
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest code in bytes wins.
  
[Answer]
# Perl, ~~125~~ 117 bytes
```
$-=<>;{$_=($-%20?(""," .
"," ..
","...
","....
")[$-%5]."----
"x($-/5&3):"<  >
").$_;($-/=20)&&($_=$/.$_,redo)}print
```
Thanks to Dom Hastings for helping me save 8 bytes.
[Answer]
# JavaScript ES6, 143 bytes
Loads of bytes added because need to `console.log`, could save another 23 bytes without it.
```
n=>console.log((d=(x,s='',l=1,j=x/l|0)=>s+(j>19?d(x,s,l*20)+`
`:'')+((j=j%20)?(' '+`.`.repeat(j%5)).slice(-4)+`
----`.repeat(j/5):'<  >'))(n))
```
[Answer]
# Mathematica ~~185 182 171~~ 153
With 18 bytes saved thanks to Arcinde's suggestion to use anonymous functions,
```
c=Column;c[If[#>0,{q,r}=#~QuotientRemainder~5;c@{{""," ."," .."," ...","...."}[[r+1]],c@{{""},{d="----"},{d,d},{d,d,d}}[[q+1]]},"< >"]&/@#~IntegerDigits~20]&
```
**Example**
```
c[If[# > 0, {q, r} = #~QuotientRemainder~5; c@{{"", " .", " ..", " ...", "...."}[[r + 1]], c@{{""}, {d = "----"}, {d, d}, {d, d, d}}[[q + 1]]}, "< >"] & /@ #~IntegerDigits~20] &[31415]
```
[![output](https://i.stack.imgur.com/VY9GL.png)](https://i.stack.imgur.com/VY9GL.png)
---
**Checking**
The decimal number, 31415, expressed in base 20.
Mathematica employs lower case for this.
```
BaseForm[31415, 20]
```
[![base 20](https://i.stack.imgur.com/uFwnA.png)](https://i.stack.imgur.com/uFwnA.png)
---
The decimal digits corresponding to the above base 20 number.
```
IntegerDigits[31415,20]
```
> 
> {3, 18, 10, 15}
> 
> 
> 
---
**Another example**
```
IntegerDigits[2147483607, 20]
```
> 
> {1, 13, 11, 1, 15, 9, 0, 7}
> 
> 
> 
```
c[If[# > 0, {q, r} = #~QuotientRemainder~5;c@{{"", " .", " ..", " ...","...."}[[r + 1]], c@{{""}, {d = "----"}, {d, d}, {d, d, d}}[[q + 1]]},"< >"] & /@ #~IntegerDigits~20] &[2147483607]
```
[![ex2](https://i.stack.imgur.com/ZYAD8.png)](https://i.stack.imgur.com/ZYAD8.png)
[Answer]
# Pyth, 41 bytes
```
j+bbm|jb_m.[\ 4kc:*d\.*5\.*4\-4"<  >"jQ20
```
Try it online: [Demonstration](http://pyth.herokuapp.com/?code=j%2Bbbm%7Cjb_m.%5B%5C%204kc%3A*d%5C.*5%5C.*4%5C-4%22%3C%20%20%3E%22jQ20&input=42&debug=0)
### Explanation:
```
                                     jQ20   convert input to base 20
    m                                       map each value d to:
                  *d\.                         string of d points
                 :    *5\.*4\-                 replace 5 points by 4 -s
                c             4                split into groups of 4
         m.[\ 4k                               center each group
        _                                      invert order
      jb                                       join by newlines
     |                         "<  >"          or if 0 use "<  >"
j+bb                                        join by double newlines
```
[Answer]
## JavaScript (ES6), 157 bytes
The newlines are significant and are counted as 1 byte each. Since printing to STDOUT is required, `console.log` cost me a few bytes there.
```
f=i=>console.log([...i.toString(20)].map(j=>(!(j=parseInt(j,20))||j%5?[`<  >`,` .`,` ..`,`...`,`....`][j%5]+`
`:'')+`----
`.repeat(j/5)).join`
`.slice(0,-1))
```
### Demo
For demonstration purposes I'll write an ES5 version so it works in all browsers:
```
// Snippet stuff
console.log = function(x) {
  O.innerHTML = x;
}
document.getElementById('I').addEventListener('change', function() {
  f(this.valueAsNumber);
}, false);
// Actual function
f = function(i) {
  console.log(i.toString(20).split('').map(function(j) {
    return (! (j = parseInt(j, 20)) || j % 5 ? ['<  >', ' .', ' ..', '...', '....'][j % 5] + '\n' : '') + '----\n'.repeat(j / 5);
  }).join('\n').slice(0,-1));
}
```
```
<input type=number min=0 max=2147483647 value=0 id=I>
<pre><output id=O></output></pre>
```
[Answer]
# Python 2.x, 142 bytes:
```
def m(n):
 h=[[""," "*(2-n%5/2)+"."*(n%5)+"\n"][n%5!=0]+"----\n"*(n%20/5),"<  >\n"][n%20==0]
 n/=20
 if n>0:
  h=m(n)+"\n\n"+h
 return h[:-1]
```
Example:
```
>>> print m(2012)
----
<  >
 ..
----
----
>>> 
```
Edit: trailing line...
[Answer]
# CJam, ~~82~~ 76 bytes
```
li{_K%[""" .
"" ..
""...
""....
"]1$5%='-4*N+2$5/3&*+"<  >
"?N+L+:L;K/}h;L);
```
My first CJam program, basically just a transliteration of my Perl answer to CJam.
[Try online](http://cjam.aditsu.net/#code=li%7B_K%25%5B%22%22%22%20.%0A%22%22%20..%0A%22%22...%0A%22%22....%0A%22%5D1%245%25%3D'-4*N%2B2%245%2F3%26*%2B%22%3C%20%20%3E%0A%22%3FN%2BL%2B%3AL%3BK%2F%7Dh%3BL)%3B&input=123456789)
Multi-line with comments:
```
li            # read input
{             # start of do-while loop
  _K%         # check if this base-20 digit is a zero
    [""" .
    "" ..
    ""...
    ""....
    "]1$5%=   # push dots for 1s onto stack
    '-4*N+2$5/3&*+    # push lines for 5s onto stack
    "<  >
    "         # push zero on stack
  ?           # ternary if test (for digit equals zero)
  N+L+:L;     # pre-concatenate string with output plus newline
  K/          # divide by 20
}h            # end of do while loop
;L);          # push output string on stack, chop off trailing newline
```
[Answer]
## PHP, 220 bytes
Same approach as my JavaScript answer. PHP has built-in functions for everything.
Takes 1 input from the command line (i.e. STDIN), as seen with `$argv[1]`:
```
<?=rtrim(implode("\n",array_map(function($j){return(!($j=base_convert($j,20,10))||$j%5?['<  >', ' .', ' ..', '...', '....'][$j%5]."\n":'').str_repeat("----\n",$j/5);},str_split(base_convert($argv[1],10,20)))));
```
[Answer]
## C - 149
```
f(v){v/20&&(f(v/20),puts("\n"));if(v%=20)for(v%5&&printf("%3s%s","...."+4-v%5,v/5?"\n":""),v/=5;v--;v&&puts(""))printf("----");else printf("<  >");}
```
Uses recursion to print most significant numbers first. Then either prints zero or prints all dots with one *clever* `printf` and all fives in a loop. I am not sure if I can avoid using if-else here.
The downside of clever printf is that 1 and 3 are not aligned to each other:
Result for 23 is:
```
  .
...
```
## ~~119~~ incorrect solution - trailing newline
```
f(v){v/20&&(f(v/20),puts(""));if(v%=20)for(v%5&&printf("%3s\n","...."+4-v%5),v/=5;v--;)puts("----");else puts("<  >");}
```
[Answer]
# PHP, ~~202~~ 192 bytes
```
function m($n){return(($c=($n-($r=$n%20))/20)?m($c)."\n":"").
($r?(($q=$r%5)?substr(" .   .. ... ....",$q*4-4,4)."\n":"").
str_repeat("----\n",($r-$q)/5):"<  >\n");}
echo rtrim(m($argv[1]),"\n");
```
It gets the input from the first command line argument.
The complete source code, with comments and tests, is available on [github](https://github.com/axiac/code-golf/blob/master/ascii-maya-numbers.php).
[Answer]
# Python 2, 114 bytes
This answer is based on Jakube's Pyth answer and Locoluis's Python 2 answer.
```
def f(n):d,m=divmod(n%20,5);h=[" "*(2-m/2)+"."*m+"\n----"*d,"<  >"][n%20<1];n/=20;return(f(n)+"\n\n"if n else"")+h
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~50~~ ~~49~~ 47 bytes
```
b5µṪ”.x⁶;$L<3Ɗ¡ṭ⁾--;UW¤ẋ$Ẏ$L¡Ṛø“<  >”WµẸ?
b20Ç€
```
[Try it online!](https://tio.run/##y0rNyan8/z/J9NDWhztXPWqYq1fxqHGbtYqPjfGxrkMLH@5c@6hxn66udWj4oSUPd3WrPNzVp@IDEp91eMejhjk2Cgp2QE3hQN27dthzJRkZHG5/1LTm/@H2SCCVBdR7aNuhbf//GxoZm5iamVtYAgA "Jelly – Try It Online")
`...` is now left aligned thanks to user202729's point.
[When you trick yourself into thinking `< >` is a palindrome...](https://tio.run/##y0rNyan8/z/J9NDWhztXVTg8apir96hxm7WKj41x0LGuQwsf7lz7cFc3SFwXSJuEH1pyaInKw119Kj4guVmHdzxq3GejYB0aDjRg1w57riQjg8Ptj5rW/D/cHgmksoDSh7Yd2vb/vwEA)
]