Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/Mayan-numerals/Mathematica/mayan-numerals.math
Normal file
27
Task/Mayan-numerals/Mathematica/mayan-numerals.math
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
ClearAll[MakeLengthFive, MayanNumeral]
|
||||
MakeLengthFive[ci_String] := Module[{c},
|
||||
c = If[EvenQ[StringLength[ci]], ci <> " ", ci];
|
||||
While[StringLength[c] < 5, c = " " <> c <> " "];
|
||||
c
|
||||
]
|
||||
MayanNumeral[n_Integer?Positive] := Module[{nums, q, r, c},
|
||||
nums = IntegerDigits[n, 20];
|
||||
Row[Table[
|
||||
{q, r} = QuotientRemainder[m, 5];
|
||||
If[{q, r} =!= {0, 0},
|
||||
c = Prepend[ConstantArray["-----", q], StringJoin[ConstantArray[".", r]]];
|
||||
c = Join[ConstantArray["", 4 - Length[c]], c];
|
||||
c
|
||||
,
|
||||
c = {"", "", "", "\[Theta]"}
|
||||
];
|
||||
Column[MakeLengthFive /@ c, Frame -> True]
|
||||
,
|
||||
{m, nums}
|
||||
], Spacer[1]]
|
||||
]
|
||||
MayanNumeral[4005]
|
||||
MayanNumeral[8017]
|
||||
MayanNumeral[326205]
|
||||
MayanNumeral[886205]
|
||||
MayanNumeral[1337]
|
||||
Loading…
Add table
Add a link
Reference in a new issue