Several Turing Machines, building up to a TM that stops once it has found the nth prime
Go to file
2018-04-07 15:57:19 +02:00
divisor 1.0 Add files via upload 2018-04-07 15:43:16 +02:00
divisor 1.1 Add files via upload 2018-04-07 15:44:56 +02:00
divisor 0.1 Add files via upload 2018-04-06 21:52:54 +02:00
find_nth_prime 1.1 Rename const.h to find_nth_prime 1.1/const.h 2018-04-07 15:51:09 +02:00
is_prime 1.1 Add files via upload 2018-04-07 15:50:18 +02:00
is_prime 0.1 Add files via upload 2018-04-06 22:28:18 +02:00
README.md Update README.md 2018-04-07 15:57:19 +02:00

I asked my programming teacher how to create a Turing Machine that reaches the nth prime.

He thought I was joking. He was WRONG.

I never make jokes :)

Anyways, to grok how Turing machines, as described in Automata and Computability, by Dexter C. Kozen, work, here are:

  • A Turing Machine that accepts if a number n doesn't divide another number m and rejects otherwise.
  • A Turing Machine that accepts if n doesn't divide m, or if n=m, and rejects otherwise.
  • A Turing Machine that accepts if n is prime, and rejects otherwise.
  • A Turing Machine that accepts once it has found the nth prime.

Early versions, deprecated, start with 0.

  • A Turing Machine that accepts if a number n doesn't divide another number m and rejects otherwise.
  • A Turing Machine that detects whether a number >=2 is prime.