Function Repository Resource:

NumeralRepresentation

Source Notebook

Display a representation of an integer in a specified number system

Contributed by: Wolfram|Alpha Math Team

ResourceFunction["NumeralRepresentation"][n,"system"]

displays the integer n in the numeral system specified by the string "system".

ResourceFunction["NumeralRepresentation"][n,"system",type]

displays the integer n in the numeral system "system", returning output of the specified type.

Details

Supported numeral systems include "Aegean", "Aztec", "Babylonian", "Cistercian", "Egyptian", "Greek", "Mayan", "Roman" and "Suzhou".
Supported values for type include Interpretation, Graphics and List. Roman numerals can also be returned as a String.
ResourceFunction["NumeralRepresentation"] has the Listable attribute.
ResourceFunction["NumeralRepresentation"] has the same options as Graphics, with the following additions:
FontColorBlackthe color of the numerals
FontSizeAutomaticthe size of the numerals
Spacings0.5the spacing between the numerals
"NumeralStyle""Simplified"whether to display the numeral in "Handwritten" or "Simplified" style
TooltipFalsewhether to add tooltips that show the numeral or digit values or names
The option Tooltip can take the values True, False, "PlaceValue", "SymbolValue" or "SymbolName" depending on what should be displayed on mouse hovers.

Examples

Basic Examples (2) 

Get the representation for 18 in Mayan numerals:

In[1]:=
ResourceFunction["NumeralRepresentation"][18, "Mayan"]
Out[1]=

Get a list of the numerals that represent 1124640 in Egyptian numerals:

In[2]:=
ResourceFunction["NumeralRepresentation"][1124640, "Egyptian", List]
Out[2]=

Scope (4) 

By default, numerals are returned as an Interpretation of a Graphics object:

In[3]:=
a = ResourceFunction["NumeralRepresentation"][42, "Babylonian"]
Out[3]=
In[4]:=
Head[a]
Out[4]=

Returning numerals with Interpretation allows basic computations with the numerals:

In[5]:=
ResourceFunction["NumeralRepresentation"][134, "Aegean"] + ResourceFunction["NumeralRepresentation"][482, "Aegean"]
Out[5]=
In[6]:=
ResourceFunction["NumeralRepresentation"][%, "Aegean"]
Out[6]=

The optional third argument also allows you to return numerals as simple Graphics objects or as a list of Graphics objects:

In[7]:=
ResourceFunction["NumeralRepresentation"][8423, "Aztec", Graphics]
Out[7]=
In[8]:=
ResourceFunction["NumeralRepresentation"][8423, "Aztec", List]
Out[8]=

For Roman numerals only, String is also a supported output type:

In[9]:=
ResourceFunction["NumeralRepresentation"][741, "Roman", String]
Out[9]=

Aegean (1) 

Aegean numerals are a base-10 number system. There are symbols for each power of ten from 1 to 10,000:

In[10]:=
Grid[Thread[
    Labeled[ResourceFunction["NumeralRepresentation"][#, "Aegean"], #]] & /@ (Table[Range[9], 5] * 10^Range[0, 4])]
Out[10]=

Aztec (2) 

Aztec numerals are a base-20 system, with additional symbols for 10 and small multiples of 100. There are symbols for the following values: a dot represents 1, a lozenge represents 10, a flag represents 20, feathers with increasing numbers of barbs represent 100, 200, 300 and 400, and a xiquipilli (bag) represents 8000:

In[11]:=
Grid[Thread[
    Labeled[ResourceFunction["NumeralRepresentation"][#, "Aztec"], #]] & /@ Partition[Join[Range[9], {10, 20, 100, 200, 300, 400, 8000}], 4]]
Out[11]=

Most integers can be represented in multiple ways. For example, 35 can be 35 dots (35 × 1); three lozenges with five dots (3 × 10 + 5 × 1); or one flag, one lozenge and five dots (1 × 20 + 1 × 10 + 5 × 1). NumeralRepresentation returns just the representation with the fewest number of symbols needed:

In[12]:=
ResourceFunction["NumeralRepresentation"][35, "Aztec"]
Out[12]=

Babylonian (2) 

Babylonian numerals are a base-60 system. There is a symbol for a unit and a symbol for a ten:

In[13]:=
Row[Thread[
    Labeled[ResourceFunction["NumeralRepresentation"][#, "Babylonian"], #]] & /@ {1, 10}]
Out[13]=

Here are the Babylonian numerals for 1 - 60:

In[14]:=
Grid[Thread[
    Labeled[ResourceFunction["NumeralRepresentation"][#, "Babylonian"], #]] & /@ Partition[Range[60], 10]]
Out[14]=

Cistercian (2) 

Cistercian numerals are a base-10 system where each number from 1 - 9999 has a unique symbol. The symbols have four parts (top right, top left, bottom right and bottom left), each of which corresponds to a place value (ones, tens, hundreds and thousands, respectively):

In[15]:=
Row[Thread[
    Labeled[ResourceFunction["NumeralRepresentation"][#, "Cistercian"], #]] & /@ (10^Range[0, 3]), Spacer[20]]
Out[15]=

Here are the Cistercian numerals for 1 - 9:

In[16]:=
Row[Thread[
    Labeled[ResourceFunction["NumeralRepresentation"][#, "Cistercian"], #]] & /@ Range[9], Spacer[20]]
Out[16]=

Egyptian (2) 

Egyptian numerals are a base-10 number system. There are symbols for each power of ten from 0 to 6 (i.e., 1 to 1,000,000), each made of a figure representing an object:

In[17]:=
Row[Thread[
    Labeled[ResourceFunction["NumeralRepresentation"][#, "Egyptian"], #]] & /@ Prepend[10^Range[0, 6], 0], " "]
Out[17]=

Up to the ten thousands, the Egyptian symbols are arranged in rows or columns to form each place value. For hundred thousands and millions, NumeralRepresentation just places the repeated symbols in a single row:

In[18]:=
ResourceFunction["NumeralRepresentation"][7777777, "Egyptian"]
Out[18]=

Greek (2) 

Greek numerals are a positional base-10 numeral system. There are separate characters for the digits 1 - 9, the multiples of 10 from 10 - 90, and the multiples of 100 from 100 - 900:

In[19]:=
Grid[Thread[
    Labeled[ResourceFunction["NumeralRepresentation"][#, "Greek"], #]] & /@ (Table[Range[9], 3] * 10^Range[0, 2])]
Out[19]=

There is a single character that represents 1000, and multiples of 1000 are distinguished by adding an additional character to its upper left:

In[20]:=
Row[Thread[
    Labeled[ResourceFunction["NumeralRepresentation"][#, "Greek"], #]] & /@ Range[1000, 9000, 1000]]
Out[20]=

Mayan (3) 

Mayan numerals are a positional base-20 system. There symbols include a dot for one, a bar for five and a shell for zero:

In[21]:=
Row[Thread[
    Labeled[ResourceFunction["NumeralRepresentation"][#, "Mayan"], #]] & /@ {0, 1, 5}]
Out[21]=

Numerals are stacked vertically from bottom to top. The bottom group of symbols represents ones, the next group up represents twenties, the next group up represents four-hundreds (202), and so on. For example, the numeral 1357 is written as follows:

In[22]:=
Grid[{
  {"3 \[Times] (1 \[Times] 400)", ResourceFunction["NumeralRepresentation"][3, "Mayan"]},
  {"(1 \[Times] (5 \[Times] 20)) + (2 \[Times] (1 \[Times] 20))", ResourceFunction["NumeralRepresentation"][7, "Mayan"]},
  {"(3 \[Times] (5 \[Times] 20)) + (2 \[Times] (1 \[Times] 20))", ResourceFunction["NumeralRepresentation"][17, "Mayan"]}
  }]
Out[22]=

Here are the Mayan numerals from 1 to 20:

In[23]:=
Grid[Thread[
    Labeled[ResourceFunction["NumeralRepresentation"][#, "Mayan"], #]] & /@ Partition[Range[20], 10]]
Out[23]=

Roman (2) 

Roman numerals are a base-ten number system comprised of seven symbols (1, 5, 10, 50, 100, 500, 1000):

In[24]:=
Row[Thread[
    Labeled[ResourceFunction["NumeralRepresentation"][#, "Roman"], #]] & /@ {1, 5, 10, 50, 100, 500, 1000}]
Out[24]=

A vinculum (overbar) represents multiplication by 1000 and can be used to represent large numbers:

In[25]:=
ResourceFunction["NumeralRepresentation"][5000, "Roman"]
Out[25]=

Suzhou (2) 

Suzhou numerals are a positional base-10 system, with separate symbols for the digits 0 - 9. Here are all of the Suzhou numeral symbols:

In[26]:=
Row[Thread[
    Labeled[ResourceFunction["NumeralRepresentation"][#, "Suzhou"], #]] & /@ Range[0, 9]]
Out[26]=

When the characters for ones, twos or threes are written consecutively, they are rotated so as not to run together. For example:

In[27]:=
ResourceFunction["NumeralRepresentation"][2311, "Suzhou"]
Out[27]=

Options (8) 

NumeralStyle (1) 

Each numeral type can be displayed in either a "Simplified" or a "Handwritten" style:

In[28]:=
ResourceFunction["NumeralRepresentation"][12415,  "Suzhou", "NumeralStyle" -> "Simplified"]
Out[28]=
In[29]:=
ResourceFunction["NumeralRepresentation"][12415,  "Suzhou", "NumeralStyle" -> "Handwritten"]
Out[29]=
In[30]:=
ResourceFunction["NumeralRepresentation"][624,  "Greek", "NumeralStyle" -> "Simplified"]
Out[30]=
In[31]:=
ResourceFunction["NumeralRepresentation"][624,  "Greek", "NumeralStyle" -> "Handwritten"]
Out[31]=

Tooltip (3) 

Setting TooltipTrue is the same as setting Tooltip"PlaceValue", where each digit in the numeral has a tooltip displaying its place value:

In[32]:=
ResourceFunction["NumeralRepresentation"][2630, "Egyptian", Tooltip -> True]
Out[32]=

Setting Tooltip"SymbolValue" adds a tooltip to each symbol within each digit, showing its value:

In[33]:=
ResourceFunction["NumeralRepresentation"][2630, "Egyptian", Tooltip -> "SymbolValue"]
Out[33]=

Setting Tooltip"SymbolName" adds a tooltip to each symbol within each digit, showing a string describing each symbol:

In[34]:=
ResourceFunction["NumeralRepresentation"][2630, "Egyptian", Tooltip -> "SymbolName"]
Out[34]=

FontColor (1) 

The FontColor option controls the color in which the numerals are rendered:

In[35]:=
ResourceFunction["NumeralRepresentation"][1487, "Aegean", FontColor -> Pink]
Out[35]=

FontSize (1) 

The FontSize option controls the size in which the numerals are rendered:

In[36]:=
ResourceFunction["NumeralRepresentation"][9273, "Greek", FontSize -> #] & /@ {10, 20, 30}
Out[36]=

Spacings (2) 

The Spacings option controls the spacing between the numerals:

In[37]:=
ResourceFunction["NumeralRepresentation"][725, "Egyptian", Spacings -> #] & /@ Range[0, 3]
Out[37]=

For the vertically-arranged Mayan numeral system, Spacings adjusts the vertical spacing of the numerals:

In[38]:=
ResourceFunction["NumeralRepresentation"][725, "Mayan", Spacings -> #] & /@ Range[0, 3]
Out[38]=

Possible Issues (3) 

Several of the numeral systems have an upper limit on the values which have representations:

In[39]:=
ResourceFunction["NumeralRepresentation"][1000000, "Aegean"]
Out[39]=

Several of the numeral systems have no symbol that represents zero:

In[40]:=
ResourceFunction["NumeralRepresentation"][0, "Greek"]
Out[40]=

Because it is used in the arrangement of the numerals themselves, the PlotRange option of Graphics cannot be given to NumeralRepresentation:

In[41]:=
ResourceFunction["NumeralRepresentation"][123, "Egyptian", PlotRange -> {0, 1}]
Out[41]=

Publisher

Wolfram|Alpha Math Team

Version History

  • 2.0.0 – 23 March 2023
  • 1.1.0 – 13 January 2023
  • 1.0.0 – 14 October 2022

Related Resources

Author Notes

To view the full source code for NumeralRepresentation, evaluate the following:

License Information