0:00
/

Paid episode

The full episode is only available to paid subscribers of LeetArxiv

FRACTRAN: A Simple Universal Programming Language for Arithmetic

Writing a C Interpreter for the FRACTRAN Language using Conway's 1987 Paper alongside Geipel's 2017 Improvements
Quick Summary
FRACTRAN is an esolang built upon register machines, a theoretical alternative to turing machines for computation. We code the original 1987 paper to understand John Conway’s vision. We further code Geipel’s 2017 paper for fast cycle detection.

Stop reading papers. Start coding them. Subscribe for weekly paper implementations delivered to your inbox.

Abstract for the 1987 paper FRACTRAN: A Simple Universal Programming Language for Arithmetic by John Conway
I’m an index calculus (advanced logarithms) guy by profession but Trump defunded my math PhD. Please consider becoming a paid subscriber while I figure out my next move.

As usual, you can code along to the GitHub.

1.0 Paper Introduction

The 1987 paper FRACTRAN: A Simple Universal Programming Language for Arithmetic (Conway, 1987)1 implements a register machine : an alternative to Turing machines where logic is represented within arithmetic, not as read/write heads on a tape (Wesstein, 2025)2.

In the simplest terms, Fractran is a computer architecture based entirely on the multiplication of fractions (Linvega, 2008)3.

Fractran’s Start, Multiply, Stop rule. Taken from page 1 of (Conway, 1987)

The paper (Conway, 1987) asserts that a list of fractions alongside basic Start, Multiply, Stop rules permits Turing-complete computation.

1.1 Fractan Programs and Logarithms

Fractran uses prime numbers as registers and builds on the laws of logarithms we covered here. Here’s a quick recap for the noobs:

Fractan can be viewed as a slightly more general Turing machine in that it accepts an integer both as input and output, rather than outputting a boolean (Geipel, 2017)4.

So, using the laws of logarithms, Fractran accumulates results in the exponent of the prime factors of an integer.

Fractan program where prime numbers occur in the exponent. Taken from page 1 of (Conway, 1987)

2.0 Coding a Fractran Interpreter in C

A Fractran program is defined as a finite list of fractions. Given a positive integer input n, the algorithm calculates the next instruction by multiplying n with a fraction that yields another integer. The algorithm halts if no such fraction exists (Ramanathan, 2019)5.

User's avatar

Continue reading this post for free, courtesy of Murage Kibicho.