
FRACTRAN
Sign in to saveFRACTRAN is a Turing-complete esoteric programming language invented by the mathematician John Conway. A FRACTRAN program is an ordered list of positive fractions together with an initial positive integer input n. The program is run by updating the integer n as follows: for the first fraction f in the list for which nf is an integer, replace n by nf repeat this rule until no fraction in the list produces an integer when multiplied by n, then halt.
~12 min read
Encyclopedic overview
11 sectionsContents
- Understanding a FRACTRAN program
- Creating simple programs
- Addition
- Multiplication
- Subtraction and division
- Conway's prime algorithm
- Other examples
- Notes
- See also
- References
- External links
FRACTRAN is a Turing-complete esoteric programming language invented by the mathematician John Conway. A FRACTRAN program is an ordered list of positive fractions together with an initial positive integer input n. The program is run by updating the integer n as follows: for the first fraction f in the list for which nf is an integer, replace n by nf repeat this rule until no fraction in the list produces an integer when multiplied by n, then halt.
gives the following FRACTRAN program, called PRIMEGAME, which finds successive prime numbers:
Excerpted from Wikipedia’s “FRACTRAN” article, available under the CC BY-SA 4.0 licence.