Function Repository Resource:

TallyMarks

Source Notebook

Represent an integer in various forms of tally marks

Contributed by: Sander Huisman

ResourceFunction["TallyMarks"][n]

outputs tally marks displaying the integer n.

ResourceFunction["TallyMarks"][n,type]

outputs type tally marks.

ResourceFunction["TallyMarks"][n,type,m]

uses at most m characters per line.

Details and Options

The value for n should be a non-negative integer.
The following types are supported:
"Default"uses tick marks used in e.g. Europe, Americas, Africa, Australia, and New Zealand
"Chinese"uses tick marks used in e.g. China, Taiwan, Japan, Korea, and countries that use Chinese characters
"Box"uses tick marks used in e.g. France, Spain, and their former colonies and Brazil
"DotsLines"uses tick marks used in forestry and related fields
The value for m should be a positive integer, ∞ or Automatic. For the setting Automatic, the marks will be set in a roughly square arrangement.
ResourceFunction["TallyMarks"] has the following option:
"Noise"Falsefraction of noise to add to the position of the lines and the position and size of the dots.
Possible forms for the option "Noise" are:
TrueAdds 0.02 (2%) noise.
FalseAdds no noise (Default).
sAdds an amount s of noise.

Examples

Basic Examples (3) 

Display 37 in tally marks:

In[1]:=
ResourceFunction["TallyMarks"][37]
Out[1]=

Use the Chinese type of tally marks instead:

In[2]:=
ResourceFunction["TallyMarks"][37, "Chinese"]
Out[2]=

Set a maximum of 5 characters per line:

In[3]:=
ResourceFunction["TallyMarks"][37, "Chinese", 5]
Out[3]=

Scope (4) 

Show the various types of tally marks for the number 42:

In[4]:=
Table[Column[{t, ResourceFunction["TallyMarks"][42, t]}, Center], {t, {"Default", "Chinese", "Box", "DotsLines"}}] // Column
Out[4]=

Set the number of symbols per line to 1:

In[5]:=
ResourceFunction["TallyMarks"][27, "Default", 1]
Out[5]=

Set the number of symbols per line to 5:

In[6]:=
ResourceFunction["TallyMarks"][62, "Default", 5]
Out[6]=

Create a roughly square arrangement:

In[7]:=
ResourceFunction["TallyMarks"][333, "Box", Automatic]
Out[7]=

Options (2) 

Noise (2) 

Add the default amount of noise:

In[8]:=
ResourceFunction["TallyMarks"][23, "Noise" -> True]
Out[8]=

Add different levels of noise:

In[9]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/3b484265-7da2-43d3-bc6e-346c5563cabf"]
Out[9]=

Publisher

SHuisman

Version History

  • 2.0.0 – 10 May 2022
  • 1.0.0 – 14 December 2020

Related Resources

License Information