🔗 FRACTRAN
🔗 Computing
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.
Conway 1987 gives the following formula for primes in FRACTRAN:
Starting with n=2, this FRACTRAN program generates the following sequence of integers:
- 2, 15, 825, 725, 1925, 2275, 425, 390, 330, 290, 770, ... (sequence A007542 in the OEIS)
After 2, this sequence contains the following powers of 2:
- (sequence A034785 in the OEIS)
which are the prime powers of 2.
Discussed on
- "FRACTRAN" | 2017-04-26 | 82 Upvotes 8 Comments