Library

NDTM · Recursively enumerable

Is n composite? Guess a factor

Accepts 1ⁿ exactly when n is composite: the machine guesses a factor p, then verifies it by dealing the remaining 1s into rounds of p. Primality by nondeterministic elimination.

seedguess pnext Xcross 1last cro…reset ru…any 1s l…acc
The machine as drawn — 8 states, 21 transitions.

The author’s examples, run

1111 → accept111111 → accept111111111 → accept11111 → reject1111111 → reject