Multiplicity
A program is one number. Only how often each prime divides it matters.
None1, 2023 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 5 known programs · Test method
Run it
The idea
None1 made Multiplicity in 2023, after Factor. Where Factor reads the primes themselves, Multiplicity reads their multiplicities. The number is factorized, the prime factors are sorted, and each one becomes a brainfuck command chosen by its multiplicity mod 8. Primes that do not divide the number are skipped, so 2<sup>8</sup> times 11<sup>7</sup> is a program of two commands.
The machine
| Multiplicity mod 8 | Command |
|---|---|
| 0 | , |
| 1 | + |
| 2 | - |
| 3 | > |
| 4 | < |
| 5 | [ |
| 6 | ] |
| 7 | . |
The brainfuck runs as the Python interpreter in the specification runs it, on a million 8-bit cells. A , at the end of the input gives 0, where that interpreter stops with an error.
Example
The cat is 2<sup>8</sup> 3<sup>5</sup> 5<sup>7</sup> 7<sup>8</sup> 11<sup>6</sup>, which spells ,[.,].
The cat is 2<sup>8</sup> 3<sup>5</sup> 5<sup>7</sup> 7<sup>8</sup> 11<sup>6</sup>, which spells ,[.,]. The second number is 2<sup>8</sup> 11<sup>7</sup>, the one-time cat ,.. The Hello World has 683 digits for 106 brainfuck commands. The specification also has a truth machine, 99 bottles of beer in 9,872 digits and a brainfuck interpreter made from dbfi, and all of them work.
Patterns it teaches
- Encoding tricks: a program hidden in a factorization.
- Turing tarpit: brainfuck underneath.
Further
See also
Multiplicity builds on Brainfuck.
Zero-dimensional languages
Brainfuck equivalents
Write your own in Run Convert a program from Multiplicity
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: multiplicity.
Command line
shib run multiplicity -e '49633705594394460000000' --input 'abc'shib manual multiplicitySource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/multiplicity.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org