We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
ChooseNumber
ChooseNumber is yet another OISC invented by User:None1 and inspired by ChooseMatrix, Minsky machine and Tip.
Memory
ChooseNumber has only one unbounded integer x, which is 2 (neither 0 nor 1!) initially (if there's no input).
Command
The only command is simple:
a b c
If x is divisible by a, let x be x*b/c.
The IP wraps around, so after the last command the IP goes back to the start. Other than that, there's no control flow.
Halting (Optional)
Attempting to set x to a non-integer, 0 or 1 terminates the program. Dividing by zero will also terminate the program. This is an optional feature and doesn't affect its computational class.
I/O (Optional)
Unlike one of its predecessors ChooseMatrix, ChooseNumber can be extended to have I/O. Input is easy: Just start with a number other than 2. Output only happens when a command attempts to halt the program, in which case the value of x before executing that command is printed. There's no output when halting because of division by zero.
Computational class
pi stands for the i-th prime in the following text.
ChooseNumber is Turing-complete because it can simulate a 2-register Minsky machine.
Number theory allows us to factorize a number into its prime factors, so we actually have an infinite number of accumulators we can add and subtract with commands. As such, the only hard part is jumping.
First, we turn the subtraction command in Minsky machine into two separate commands: If that accumulator is 0, jump to another location. Then, subtract that accumulator by 1.
Then suppose there are n locations in the program. We use the first n command to signify the current location: If current location is i, then there is one prime factor pi in x, otherwise there is no prime factor pi in x. In this way, checking if current location matches a command is easy and jumping can simply be done by dividing by a prime and multiplying by another.
Interpreter
Python
import sys
k=[list(map(int,i.split())) for i in sys.stdin.read().strip().split('\n')]
try:
x=int(input())
except:
x=2
while 1:
for a,b,c in k:
if x%a==0:
if not c:
sys.exit()
if x*b%c:
print(x)
sys.exit()
t=x*b//c
if t in [0,1]:
print(x)
sys.exit()
x=t
A shorter interpreter without optional features:
x,k=2,[list(map(int,i.split())) for i in __import__('sys').stdin.read().strip().split('\n')]
while 1:
for a,b,c in k:
if x%a==0:x=x*b//c
See also
- Fractran, almost the same thing.