Function Repository Resource:

KoremutakeConvert

Source Notebook

Convert to and from Koremutake memorable random strings

Contributed by: Anton Antonov

ResourceFunction["KoremutakeConvert"][n]

converts the integer n into a Koremutake memorable string.

ResourceFunction["KoremutakeConvert"][s]

converts the given Koremutake string s into an integer.

Details

Koremutake representation is a way to express any large number as a sequence of syllables. The general idea is that pieces of information that sound like words are a lot easier to remember than a sequence of digits.
ResourceFunction["KoremutakeConvert"] can take integers and strings as arguments.
String case is ignored.
Representations of negative integers are prefixed with "minus".
The syllable-to-integer mapping can be obtained by using "SyllableMapping" as an argument.
The integer-to-syllable mapping can be obtained by using "IntegerMapping" as an argument.
ResourceFunction["KoremutakeConvert"] threads over lists.

Examples

Basic Examples (3) 

Convert an integer into a Koremutake memorable string:

In[1]:=
ResourceFunction["KoremutakeConvert"][1307723]
Out[1]=

Convert a negative integer:

In[2]:=
ResourceFunction["KoremutakeConvert"][-1293]
Out[2]=

Convert a Koremutake string into an integer:

In[3]:=
ResourceFunction["KoremutakeConvert"]["tefriso"]
Out[3]=

Scope (3) 

The function Koremutake works on lists (it has the attribute Listable):

In[4]:=
ResourceFunction["KoremutakeConvert"][{"tefriso", 2300, 12}]
Out[4]=

Get the syllable-to-integer mapping:

In[5]:=
ResourceFunction["KoremutakeConvert"]["SyllableMapping"]
Out[5]=

Get the integer-to-syllable mapping:

In[6]:=
ResourceFunction["KoremutakeConvert"]["IntegerMapping"]
Out[6]=

Applications (2) 

Generate memorable strings for a list of large primes:

In[7]:=
SeedRandom[44];
res = Association@
  Map[# -> ResourceFunction["KoremutakeConvert"][#] &, Prime /@ RandomInteger[{10^5, 10^7}, 5]]
Out[7]=

Convert the obtained memorable strings into integers:

In[8]:=
res2 = ResourceFunction["KoremutakeConvert"][res]
Out[8]=

Properties and Relations (4) 

Random integers can be converted to memorable strings:

In[9]:=
SeedRandom[93];
ResourceFunction["KoremutakeConvert"][RandomInteger[{-10^5, 10^5}, 6]]
Out[9]=

Using the resource function Soundex, you can "generalize" the Koremutake representations into Soundex codes:

In[10]:=
kos = ResourceFunction["KoremutakeConvert"][{12002, 88922}]
Out[10]=
In[11]:=
ResourceFunction["Soundex"] /@ kos
Out[11]=

Note that variations of "dribro" and "branaby" are represented with the same Soundex codes:

In[12]:=
ResourceFunction["Soundex"]@{"dribro", "dribbrro", "branaby", "brannaby", "brrannaby"}
Out[12]=

The variations with "too many" consonants are not recognized by KoremutakeConvert:

In[13]:=
Quiet[ResourceFunction[
  "KoremutakeConvert"]@{"dribro", "dribbrro", "branaby", "brannaby", "brrannaby"}]
Out[13]=

Here a random tabular dataset is generated with the resource function RandomTabularDataset, which has a "Koremutake" column:

In[14]:=
SeedRandom[564];
ResourceFunction[
  "RandomTabularDataset"][{4, {"SomethingRandom", "Koremutake", "SomethinRandom2"}}, "Generators" -> <|
   "Koremutake" -> Function[{n}, ResourceFunction["KoremutakeConvert"][
      RandomInteger[{0, 10^6}, n]]]|>]
Out[14]=

KoremutakeConvert is self-inverting:

In[15]:=
ResourceFunction["KoremutakeConvert"]@
 ResourceFunction["KoremutakeConvert"]@"koremutake"
Out[15]=

Neat Examples (3) 

Get the number represented by "Koremutake", find the list of prime factors and represent those factors with Koremutake strings:

In[16]:=
ResourceFunction["KoremutakeConvert"]["Koremutake"]
Out[16]=
In[17]:=
FactorInteger[ResourceFunction["KoremutakeConvert"]["Koremutake"]]
Out[17]=
In[18]:=
ResourceFunction["KoremutakeConvert"][First /@ %]
Out[18]=

Find pet names that are valid Koremutake strings:

In[19]:=
AbsoluteTiming[
 pnres = Quiet[
   Map[AssociationThread[
      Keys[#] -> ResourceFunction["KoremutakeConvert"][Keys[#]]] &, ResourceFunction["RandomPetName"][All]]];
 pnres = Map[Select[#, IntegerQ] &, pnres];
 ]
Out[19]=

Here is the number of pet names that are Koremutake strings per species:

In[20]:=
Length /@ pnres
Out[20]=

Here are samples per species of Koremutake pet names:

In[21]:=
RandomSample[Keys@#, UpTo[4]] & /@ pnres
Out[21]=

Generate random numbers:

In[22]:=
SeedRandom[884];
rnums = Join[RandomInteger[{10, 10^3}, 2], RandomInteger[{10^5, 10^6}, 3]]
Out[22]=

Convert to Koremutake strings and make a "phrase":

In[23]:=
kos = StringRiffle[ResourceFunction["KoremutakeConvert"]@rnums, " "]
Out[23]=

Speak the Koremutake representations of the random numbers:

In[24]:=
Speak[kos]

Publisher

Anton Antonov

Version History

  • 1.0.0 – 16 November 2021

Related Resources

Author Notes

See shorl.com for more detailed explanations.

License Information