User:Vel!/Turing golf


 * Scoring rules have recently changed. Not that anyone scores their TMs anyway :P

Your challenge in each of these problems is to construct a Turing machine that computes things.

Rules:
 * Use only standard Turing machines except where otherwise noted.
 * Your score is \(\text{states} \times \text{colors}^2\). Like golf, you are trying to minimize your score for each challenge.
 * If you allow your machine to make a null move, it becomes \((\text{states} + 1) \times \text{colors}^2\).
 * Input and output formats are up to you. Usually the input consists of one or more strings of ones separated by single blanks.
 * You are absolutely free to break these rules and try to do these using other restricted programming environments. Lambda calculus, Brainf***, anything you want. You have to come up with your own scoring system, however.
 * Please add your own challenges to this page! They are ordered roughly by perceived difficulty.
 * Leave comments on the |talk page. Anything that's not a Turing machine or a challenge goes there.

Maybe someday I'll offer prizes. (Which, of course, will be math books.)

Addition
Given two inputs \(n\) and \(m\), compute \(n + m\).

Deedlit's answer
Assuming \(n\) and \(m\) are strings of ones separated by a space, we can use:

0 _ 1 r 1 0 1 1 r 0 1 _ _ l 2 1 1 1 r 1 2 1 _ l halt 2 _ _ l halt

It just fills in the blank and eliminates the rightmost 1. Deedlit11 (talk) 00:17, April 4, 2013 (UTC)

FB100Z's answer
0 1 _ r 1 1 1 * r * 1 _ 1 * halt

This one's even simpler, removing the leftmost 1 then filling the blank. FB100Z &bull; talk &bull; contribs 03:21, April 4, 2013 (UTC)

Comparison
Given two inputs \(n\) and \(m\), determine whether \(n < m\), \(n = m\), or \(n > m\).

Aarex's answer
0 1 * l 0 0 _ * r 1 1 1 _ r 2 1 _ < * halt 2 1 * r 2 2 _ * r 3 3 1 * r 3 3 _ * l 4 4 1 _ l 5 4 _ > * halt 5 1 * l 5 5 _ * l 0

Aarex (talk) 00:38, April 4, 2013 (UTC)

Unfortunately this doesn't handle equality correctly, but it's easy to fix:

0 1 * l 0 0 _ * r 1 1 1 _ r 2 1 _ _ r 6 2 1 * r 2 2 _ * r 3 3 1 * r 3 3 _ * l 4 4 1 _ l 5 4 _ > l halt 5 1 * l 5 5 _ * l 0 6 _ = l halt 6 1 < l halt

Deedlit11 (talk) 02:59, April 5, 2013 (UTC)

FB100Z's answer
0 1 * r * 0 _ * r r2 r2 1 * r * r2 _ * l r3 r3 1 _ l l1 r3 _ * * halt

l1 1 * l * l1 _ * l l2 l2 1 * l * l2 _ * l l3 l3 1 _ r 0 l3 _ * * halt

I'm not sure if this counts.

FB100Z &bull; talk &bull; contribs 03:26, April 4, 2013 (UTC)

LittlePeng9's answer
; Output is a character under scanning head after halting 0 1 1 r 0 0 _ > r 1 1 < > r 1 1 1 < l 2 1 _ _ l 3 2 > < l 2 2 1 > r 1 2 _ _ r halt 3 > _ l 3 3 _ = * halt 3 1 > * halt First of three to succesfully determine equality. As we need symbols to write output anyway, I used them for execution.

LittlePeng9 (talk) 16:21, April 4, 2013 (UTC)

Duplication
Given \(n\), output two copies of \(n\).

Ikosarakt's answer
0 _ _ l halt 0 1 _ r 1 1 1 * r 1 1 _ * r 2 2 _ 1 r 3 2 1 * r 2 3 _ 1 l 4 4 _ * l 5 4 1 * l 4 5 _ * r 0 5 1 * l 5

Ikosarakt1 (talk ^ contribs) 07:41, April 4, 2013 (UTC)

LittlePeng9's answer
; Output is two copies of input with blank inbetween 0 1 _ r 1 0 _ _ r halt 1 1 1 r 1 1 _ _ r 2 2 1 1 r 2 2 _ 1 l 3 3 1 1 l 3 3 _ _ l 4 4 1 1 l 4 4 _ 1 r 0 LittlePeng9 (talk) 15:36, April 4, 2013 (UTC)

Palindrome
Test whether an input is a palindrome.

FB100Z's answer
This is a Python script that creates a Turing machine. Handles up to 10 symbols.

n = 10

print('0 * * * read') print('read _ P * halt') for i in range(n): print('read {0} _ r gr{0}'.format(i))

for i in range(n): print('gr{0} _ * l chk{0}'.format(i)) print('gr{0} * * r *'.format(i))

for i in range(n): print('chk{0} _ P * halt'.format(i)) print('chk{0} {0} _ l gl'.format(i)) print('chk{0} * N * halt'.format(i))

print('gl _ * r read') print('gl * * l *'.format(i))

The number of states is 2c + 2.

My main motivation for this is the Lychrel problem. FB100Z &bull; talk &bull; contribs 19:42, April 14, 2013 (UTC)

LittlePeng9's answer
To check if finite string of positive integers is palindrome, replace each integer n with string of n 1's and blanks every two integers. Character under halted head is answer. 0 1 1 r 0 0 _ y r 1 1 1 1 r 0 1 _ _ l 2 2 y _ l 3 3 1 _ l 4 3 y _ l 6 4 * * l 4 4 _ _ r 5 5 1 _ r 8 5 y _ * halt 6 * * l 6 6 _ _ r 7 7 y _ r 8 7 1 _ * halt 8 * * r 8 8 _ _ l 3 * _ 1 * halt Alternatively, piece of C++ code creating set of transitions for any set of characters: using namespace std; ofstream outFile("palindrome.txt"); int main{ outFile<<"1 * * l 1"<<endl<<"1 _ _ r 0"<
 * 2) include

Polynomial
Given a sequence \(a_0, a_1, a_2, \ldots, a_n\) and an input \(x\), compute \(\sum_{i = 0}^n a_nx^n\); i.e. the polynomial with coefficients \(a_i\) and input \(x\).

Factorial
Compute \(n!\) given \(n\).

Ikosarakt's answer
0 _ 1 r halt 0 1 _ r 50 1 1 * r 1 1 _ * r 2 2 _ * r 3 3 _ 1 l 4 3 1 * r 3 4 _ * l 5 4 1 * l 4 5 _ * l 6 6 _ 1 r 7 6 1 * l 6 7 1 _ r 1 7 _ 2 l 8 8 2 * l 8 8 1 * l 8 8 _ * r 9 9 1 _ r 10 9 2 _ r halt 10 1 _ r 11 10 2 * r 40 11 1 * r 11 11 2 * r 11 11 _ * r 12 12 _ * r 12 12 1 * r 13 13 1 * r 13 13 _ * r 14 14 1 * r 14 14 _ 1 l 15 15 _ * l 16 15 1 * l 15 16 1 * l 16 16 _ * l 45 17 2 * l 17 17 1 * l 17 17 _ 1 r 10 18 _ * r 46 18 1 _ r 33 19 1 * r 19 19 _ * r 20 20 _ * l 25 20 1 * r 28 21 1 * r 21 21 _ * r 22 22 _ 1 l 23 22 1 * r 22 23 _ * l 24 23 1 * l 23 24 1 * l 24 24 _ 1 r 32 25 1 * l 25 25 _ * l 26 26 1 * l 25 26 _ * r 27 27 _ * r 18 28 1 * r 28 28 _ * r 29 29 1 * r 28 29 _ * l 30 30 _ * l 31 31 1 * l 31 31 _ * r 32 32 1 _ r 21 32 _ * l 25 33 _ * r 34 33 1 * r 19 34 _ * r halt 34 1 _ r 35 35 1 * r 35 35 _ 1 r 36 36 _ * r 37 36 1 * r 36 37 _ * l 41 37 1 * l 38 38 _ * l 39 39 1 * l 39 39 _ * r 34 40 _ * r 18 41 _ * l 42 42 1 * l 42 42 _ * l 43 43 _ * l 43 43 2 * l 44 44 1 * l 47 44 _ * r 9 45 _ * l 45 45 2 * l 17 46 _ * r 46 46 1 _ r 33 47 _ * r 49 47 1 * l 48 48 1 * l 48 48 _ * r 9 49 1 _ r 49 49 2 _ r halt 50 _ 1 l halt 50 1 * r 1

LittlePeng9's answer
We can reduce machine by 2 states, if we allow it to don't handle number 1 (and no else). In second transition we have to replace x0 with 1, so states x will never be used.

Edit: reduced by 5 states! ; First part of setup 0 _ 1 r halt 0 1 1 r x0 1 _ _ l 2 2 _ 1 r 3 3 _ _ r s0 ; We must check if n is 1, if it is, machine runs infinitely x0 _ _ l halt x0 1 1 l x1 x1 1 1 l 1 ; Second part of setup. This is my string duplication machine s0 1 _ r s1 s0 _ _ r 4 s1 1 1 r s1 s1 _ _ r s2 s2 1 1 r s2 s2 _ 1 l s3 s3 1 1 l s3 s3 _ _ l s4 s4 1 1 l s4 s4 _ 1 r s0 ; After duplication we have to delete 1 from second string 4 1 1 r 4 4 _ _ l 5 5 1 _ l 6 5 _ _ l 7 ; If smaller string is 1, we end setup 6 1 1 l 6 6 _ _ r s0 ; Then we duplicate 7 _ _ l 8 8 1 1 l 9 8 _ 1 l halt 9 _ _ l 10 10 1 1 l 10 10 _ _ r m0 m0 1 _ r m1 m1 1 1 r m1 m1 _ _ r m2 m2 _ _ r m2 m2 1 _ r m3 m3 1 1 r m4 m3 _ _ r m9 m4 1 1 r m4 m4 _ _ r m5 m5 1 1 r m5 m5 _ 1 l m6 m6 1 1 l m6 m6 _ _ l m7 m7 _ _ l m7 m7 1 1 l m8 m8 1 1 l m8 m8 _ _ r m2 m9 1 1 r m9 m9 _ 1 l m10 m10 1 1 l m10 m10 _ _ l m11 m11 _ 1 l m11 m11 1 1 r m12 m12 1 _ l m13 m13 1 1 l m14 m14 1 1 l m15 m14 _ _ r m16 m15 1 1 l m15 m15 _ _ r m0 m16 1 _ r m16 m16 _ _ r m17 m17 _ _ r m17 m17 1 _ r m18 m18 1 1 r m18 m18 _ 1 l 11 11 1 1 l 11 11 _ _ l 12 12 1 1 l 13 12 _ _ r 14 13 1 1 r 10 13 _ _ r 17 14 _ 1 r 15 15 1 1 r 15 15 _ _ l 16 16 1 _ l 11 17 1 _ r halt LittlePeng9 (talk) 15:50, April 5, 2013 (UTC)

Graham's number
Compute Graham's number. The score limit is 1000 &mdash; no TMs with \(g_{64}\) states!

LittlePeng9's answer
Clickity click ! LittlePeng9 (talk) 18:07, April 16, 2013 (UTC)

PRNG
Construct any pseudo-random number generator. Open problem, no scores here.

LittlePeng9's answer
; Input is arbitrary number written in binary ; Output is a lot of mess. Let say it's the number to the right of 's' 0 1 0 r 1 0 0 _ r 1 0 _ 1 r 1 1 1 _ r 2 1 0 1 r 2 1 _ 0 r 2 2 1 0 r 3 2 0 1 r 2 3 1 0 r 2 3 0 1 r 3 2 _ s l 6 3 _ s l 6 0 s s r halt 1 s s r 5 2 s s r 4 3 s s r 5 4 _ 0 l 6 5 _ 1 l 6 6 _ 0 r 0 4 * * r 4 5 * * r 5 6 * * l 6 I'm not even sure if this machine always halts! But if it does, it seems pretty random.

LittlePeng9 (talk) 17:08, April 4, 2013 (UTC)

Prime factorization
Given \(n\), factor \(n\).

LittlePeng9's answer
0 1 1 l 1 1 _ _ l 2 2 _ 1 l 3 3 _ 1 r 4 4 1 1 r 4 4 _ _ l 5 5 x x l 5 5 1 x r 6 5 _ _ r 9 6 x x r 6 6 _ _ r 7 7 x x r 7 7 y y r 7 7 1 x l 8 7 _ _ l 27 8 x x l 8 8 y y l 8 8 _ _ l 5 9 x 1 r 9 9 _ _ r 10 10 x x r 10 10 y y r 10 10 1 1 l 11 10 _ _ l 12 11 x y l 8 12 x 1 l 13 13 y 1 l 13 13 1 1 l 13 13 x 1 r 14 13 _ y l 16 14 1 1 r 14 14 _ _ l 15 15 1 _ l 13 16 1 x l 17 16 x x l 16 16 _ _ l 21 17 1 1 l 17 17 _ _ l 18 18 1 1 l 17 18 _ x r 20 18 x x l 19 19 x x l 19 19 _ x r 20 20 * * r 20 20 y y l 16 21 * * l 21 21 x x l 22 22 x x l 22 22 _ _ r 23 23 x 1 r 23 23 * * r 23 23 y _ r 24 24 1 1 r 25 25 1 1 l 26 25 _ _ l 31 26 1 1 l 4 27 * 1 l 27 27 _ y l 28 28 * 1 l 28 28 _ 1 l 29 29 1 _ l 28 29 _ _ r 30 30 * * r 30 30 y _ l 5 31 1 _ l 31 31 _ _ l 32 32 1 _ l 32 32 _ _ l halt LittlePeng9 (talk) 18:54, April 4, 2013 (UTC)

Divisor sum
Compute the sum of the divisors of \(n\).

LittlePeng9's answer
0 1 1 l 1 1 _ _ l 2 2 _ 1 r 3 3 _ _ l 4 4 x x l 4 4 1 x r 5 4 _ _ r 8 5 x x r 5 5 _ _ r 6 6 x x r 6 6 1 x l 7 6 _ _ l 25 7 x x l 7 7 _ _ l 4 8 x 1 r 8 8 _ _ r 9 9 x x r 9 9 1 1 l 7 9 _ _ l 10 10 x 1 l 10 10 _ y l 11 11 1 x l 12 11 x x l 11 11 _ _ l 15 12 1 1 l 12 12 _ _ l 13 13 x x l 13 13 _ x r 14 13 1 1 l 12 14 * * r 14 14 y y l 11 15 * * l 15 15 x x l 16 16 x x l 16 16 _ _ r 17 17 x 1 r 17 17 * * r 17 17 y y l 18 18 1 1 l 18 18 x 1 l 18 18 _ 1 l 19 19 1 _ l 18 19 _ _ r 20 20 * * r 20 20 y _ l c0 c0 1 1 l c0 c0 * * r c1 c1 1 x r c2 c1 _ _ r 21 c2 1 1 r c2 c2 * * r c3 c3 1 1 r c3 c3 * * l c4 c4 1 x l c5 c4 _ x r 26 c5 1 1 l c5 c5 * * l c0 21 * * r 21 21 _ _ l 22 22 x 1 l 22 22 1 1 l 22 22 _ _ l 23 23 x x l 23 23 _ _ r 24 24 x 1 r 24 24 _ _ l 4 25 x 1 l 25 25 _ y l 18 26 x x r 26 26 _ _ l 27 27 x _ l 27 27 _ _ l 28 28 1 1 l 28 28 _ _ l 29 29 _ _ r halt 29 1 1 r 30 30 _ 1 r 31 31 1 1 r 31 31 _ _ l 32 32 1 _ l 28 Note - states c0-c5 is Aarex's comparison machine, modified to handle x like blank and with modified output.

LittlePeng9 (talk) 05:17, April 5, 2013 (UTC)

Polyominoes function
Given n, compute how many distinct polyominoes with sine n exist.

Base converter
Given a number in specified base, and base in which the number should be converted, compute it

LittlePeng9's answer
Say we have number written in base n. For every digit a of input number create block 11...100...0 with a 1's such that block has length n-1. Between every block place x. After that place a blank and then m-1 0's, where m is output base. Output is same format as first part of input, but with digits in reverse order. Just count number of 1's in a block to get a digit. You can use it for mixed bases, too. 0 * * r 0 0 _ _ l 1 1 0 1 l 1 1 1 0 r 2 1 x x l 1 1 _ _ r 13 2 1 0 r 2 2 x x r 3 2 _ _ r 4 3 * * r 3 3 _ _ r 4 4 1 0 r 4 4 0 1 l 5 4 x x r 4 4 _ x l 7 5 0 1 l 5 5 x x l 6 5 _ _ l 1 6 * * l 6 6 _ _ l 1 7 0 0 l 7 7 * * r 8 8 0 _ r 9 8 x x r 4 9 0 0 r 9 9 x x r 10 10 0 0 r 10 10 _ 0 l 11 11 0 0 l 11 11 x x l 12 12 0 0 l 12 12 _ 0 r 8 13 * _ r 13 13 _ _ r halt LittlePeng9 (talk) 14:14, April 23, 2013 (UTC)

Pi
Compute digits of pi in any base of your choice.

Partition function
Ignoring order, there are five distinct sums that add to 4:


 * 4
 * 3 + 1
 * 2 + 2
 * 2 + 1 + 1
 * 1 + 1 + 1 + 1

Compute the number of ways you can add positive integers to get \(n\).

LittlePeng9's answer
0 1 1 l 0 0 x 1 l 0 0 _ _ l 1 1 _ _ l 2 1 1 1 l 0 1 x 1 l 0 2 1 1 l 2 2 _ 1 r 3 3 _ _ r 4 3 1 1 r 3 4 _ _ r 4 4 1 1 r 5 5 1 1 r 5 5 _ _ r 6 6 1 1 r 5 6 _ _ l 7 7 _ _ l 7 7 1 1 l 8 8 1 1 r 9 8 _ _ l 11 9 1 _ r 10 10 _ 1 l 0 11 1 1 l 12 11 _ _ r 33 12 _ _ l 11 12 1 1 r 13 13 1 _ r 13 13 _ 1 r 14 14 1 1 r 15 14 _ _ l 21 15 _ 1 r 16 16 1 _ r 15 16 _ _ l 17 17 1 _ l 18 18 _ _ l 19 18 1 1 r 14 19 1 1 l 18 20 1 1 r 20 20 * * l 21 21 1 x l 22 21 _ _ r 30 22 1 1 l 22 22 * * l 23 23 1 1 l 23 23 * * r 24 24 1 x r 25 24 _ _ l 26 25 1 1 r 25 25 * * r 20 26 * * l 26 26 _ _ r 27 27 x 1 r 27 27 _ _ r 28 28 * 1 r 28 28 _ 1 l 29 29 1 _ l 21 30 * 1 r 30 30 _ _ r 31 31 _ _ l 0 31 1 1 r 32 32 1 1 r 32 32 _ _ l 21 33 _ _ r 34 34 1 1 r 33 34 _ _ l 35 35 _ _ l 36 36 1 _ l 35 36 _ _ l halt LittlePeng9 (talk) 17:53, April 6, 2013 (UTC)

Ramsay number
Compute nth Ramsay number.

Lychrel number test
Test whether the entered number is a  or not. The machine should halt if the number is not Lychrel, and the machine should continue infinitely if it is.

Alternatively, develop an oracle TM that determines whether a number is Lychrel or not.

LittlePeng9's answer
; Input - number written in decimal 0 * * r 0 0 _ x l 2 0' 0 _ l 0a 0' _ _ r 3 0' x _ r p0 0a _ 0 r 0b 0b _ _ r 0c 0c * * r 0c 0c _ _ r 0d 0c x x r 0d 0d * * r 0d 0d _ 0 l 1 0' 1 _ l 1a 1a _ 1 r 1b 1b _ _ r 1c 1c * * r 1c 1c _ _ r 1d 1c x x r 1d 1d * * r 1d 1d _ 1 l 1 0' 2 _ l 2a 2a _ 2 r 2b 2b _ _ r 2c 2c * * r 2c 2c _ _ r 2d 2c x x r 2d 2d * * r 2d 2d _ 2 l 1 0' 3 _ l 3a 3a _ 3 r 3b 3b _ _ r 3c 3c * * r 3c 3c _ _ r 3d 3c x x r 3d 3d * * r 3d 3d _ 3 l 1 0' 4 _ l 4a 4a _ 4 r 4b 4b _ _ r 4c 4c * * r 4c 4c _ _ r 4d 4c x x r 4d 4d * * r 4d 4d _ 4 l 1 0' 5 _ l 5a 5a _ 5 r 5b 5b _ _ r 5c 5c * * r 5c 5c _ _ r 5d 5c x x r 5d 5d * * r 5d 5d _ 5 l 1 0' 6 _ l 6a 6a _ 6 r 6b 6b _ _ r 6c 6c * * r 6c 6c _ _ r 6d 6c x x r 6d 6d * * r 6d 6d _ 6 l 1 0' 7 _ l 7a 7a _ 7 r 7b 7b _ _ r 7c 7c * * r 7c 7c _ _ r 7d 7c x x r 7d 7d * * r 7d 7d _ 7 l 1 0' 8 _ l 8a 8a _ 8 r 8b 8b _ _ r 8c 8c * * r 8c 8c _ _ r 8d 8c x x r 8d 8d * * r 8d 8d _ 8 l 1 0' 9 _ l 9a 9a _ 9 r 9b 9b _ _ r 9c 9c * * r 9c 9c _ _ r 9d 9c x x r 9d 9d * * r 9d 9d _ 9 l 1 1 * * l 1 1 _ _ l 2 1 x x l 2 2 * * l 2 2 _ _ r 0' 3 1 0 l 4 3 2 1 l 4 3 3 2 l 4 3 4 3 l 4 3 5 4 l 4 3 6 5 l 4 3 7 6 l 4 3 8 7 l 4 3 9 8 l 4 3 0 9 r 3 3 _ _ l r0 4 * * l 4 4 _ _ l 5 5 _ _ l 6 6 1 2 r 7 6 2 3 r 7 6 3 4 r 7 6 4 5 r 7 6 5 6 r 7 6 6 7 r 7 6 7 8 r 7 6 8 9 r 7 6 9 0 l 6 6 * 1 r 7 7 * * r 7 7 _ _ r 0' p1 * * l p1 p1 _ _ r p0 p0 _ 1 l halt p0 0 _ r 00 00 * * r * 00 _ _ l 01 01 0 _ l p1 01 _ 1 l halt 01 * _ l h0 p0 1 _ r 10 10 * * r * 10 _ _ l 11 11 1 _ l p1 11 _ 1 l halt 11 * _ l h0 p0 2 _ r 20 20 * * r * 20 _ _ l 21 21 2 _ l p1 21 _ 1 l halt 21 * _ l h0 p0 3 _ r 30 30 * * r * 30 _ _ l 31 31 3 _ l p1 31 _ 1 l halt 31 * _ l h0 p0 4 _ r 40 40 * * r * 40 _ _ l 41 41 4 _ l p1 41 _ 1 l halt 41 * _ l h0 p0 5 _ r 50 50 * * r * 50 _ _ l 51 51 5 _ l p1 51 _ 1 l halt 51 * _ l h0 p0 6 _ r 60 60 * * r * 60 _ _ l 61 61 6 _ l p1 61 _ 1 l halt 61 * _ l h0 p0 7 _ r 70 70 * * r * 70 _ _ l 71 71 7 _ l p1 71 _ 1 l halt 71 * _ l h0 p0 8 _ r 80 80 * * r * 80 _ _ l 81 81 8 _ l p1 81 _ 1 l halt 81 * _ l h0 p0 9 _ r 90 90 * * r * 90 _ _ l 91 91 9 _ l p1 91 _ 1 l halt 91 * _ l h0 h0 * _ l h0 h0 _ _ l h1 h1 _ _ l h1 h1 * * l 2 r0 9 _ l r0 r0 _ _ l r1 r1 _ _ l r1 r1 * * l r2 r2 * * l r2 r2 _ _ r 0 Bounded version - input is made of 2 x's divided by any number of blanks, followed by 3 or more blanks and then number. Say there is n blanks. Then machine makes \(\lfloor {n \over 3} \rfloor\) reverse-and-add operations. 0 x x r 0x 0x _ _ r 0x 0x x x r 0x 0x * * r 0 0 * * r 0 0 _ x l 2 0' 0 _ l 0a 0' _ _ r 3 0' x _ r p0 0a _ 0 r 0b 0b _ _ r 0c 0c * * r 0c 0c _ _ r 0d 0c x x r 0d 0d * * r 0d 0d _ 0 l 1 0' 1 _ l 1a 1a _ 1 r 1b 1b _ _ r 1c 1c * * r 1c 1c _ _ r 1d 1c x x r 1d 1d * * r 1d 1d _ 1 l 1 0' 2 _ l 2a 2a _ 2 r 2b 2b _ _ r 2c 2c * * r 2c 2c _ _ r 2d 2c x x r 2d 2d * * r 2d 2d _ 2 l 1 0' 3 _ l 3a 3a _ 3 r 3b 3b _ _ r 3c 3c * * r 3c 3c _ _ r 3d 3c x x r 3d 3d * * r 3d 3d _ 3 l 1 0' 4 _ l 4a 4a _ 4 r 4b 4b _ _ r 4c 4c * * r 4c 4c _ _ r 4d 4c x x r 4d 4d * * r 4d 4d _ 4 l 1 0' 5 _ l 5a 5a _ 5 r 5b 5b _ _ r 5c 5c * * r 5c 5c _ _ r 5d 5c x x r 5d 5d * * r 5d 5d _ 5 l 1 0' 6 _ l 6a 6a _ 6 r 6b 6b _ _ r 6c 6c * * r 6c 6c _ _ r 6d 6c x x r 6d 6d * * r 6d 6d _ 6 l 1 0' 7 _ l 7a 7a _ 7 r 7b 7b _ _ r 7c 7c * * r 7c 7c _ _ r 7d 7c x x r 7d 7d * * r 7d 7d _ 7 l 1 0' 8 _ l 8a 8a _ 8 r 8b 8b _ _ r 8c 8c * * r 8c 8c _ _ r 8d 8c x x r 8d 8d * * r 8d 8d _ 8 l 1 0' 9 _ l 9a 9a _ 9 r 9b 9b _ _ r 9c 9c * * r 9c 9c _ _ r 9d 9c x x r 9d 9d * * r 9d 9d _ 9 l 1 1 * * l 1 1 _ _ l 2 1 x x l 2 2 * * l 2 2 _ _ r 0' 3 1 0 l 4 3 2 1 l 4 3 3 2 l 4 3 4 3 l 4 3 5 4 l 4 3 6 5 l 4 3 7 6 l 4 3 8 7 l 4 3 9 8 l 4 3 0 9 r 3 3 _ _ l r0 4 * * l 4 4 _ _ l 5 5 _ _ l 6 6 1 2 r 7 6 2 3 r 7 6 3 4 r 7 6 4 5 r 7 6 5 6 r 7 6 6 7 r 7 6 7 8 r 7 6 8 9 r 7 6 9 0 l 6 6 * 1 r 7 7 * * r 7 7 _ _ r 0' p1 * * l p1 p1 _ _ r p0 p0 _ 1 l halt p0 0 _ r 00 00 * * r * 00 _ _ l 01 01 0 _ l p1 01 _ 1 l halt 01 * _ l h0 p0 1 _ r 10 10 * * r * 10 _ _ l 11 11 1 _ l p1 11 _ 1 l halt 11 * _ l h0 p0 2 _ r 20 20 * * r * 20 _ _ l 21 21 2 _ l p1 21 _ 1 l halt 21 * _ l h0 p0 3 _ r 30 30 * * r * 30 _ _ l 31 31 3 _ l p1 31 _ 1 l halt 31 * _ l h0 p0 4 _ r 40 40 * * r * 40 _ _ l 41 41 4 _ l p1 41 _ 1 l halt 41 * _ l h0 p0 5 _ r 50 50 * * r * 50 _ _ l 51 51 5 _ l p1 51 _ 1 l halt 51 * _ l h0 p0 6 _ r 60 60 * * r * 60 _ _ l 61 61 6 _ l p1 61 _ 1 l halt 61 * _ l h0 p0 7 _ r 70 70 * * r * 70 _ _ l 71 71 7 _ l p1 71 _ 1 l halt 71 * _ l h0 p0 8 _ r 80 80 * * r * 80 _ _ l 81 81 8 _ l p1 81 _ 1 l halt 81 * _ l h0 p0 9 _ r 90 90 * * r * 90 _ _ l 91 91 9 _ l p1 91 _ 1 l halt 91 * _ l h0 h0 * _ l h0 h0 _ _ l h1 h1 _ _ l h1 h1 * * l 2 r0 9 _ l r0 r0 _ _ l r1 r1 _ _ l r1 r1 * * l r2 r2 * * l r2 r2 x _ l r3 r3 _ _ l r4 r4 _ _ l r5 r5 _ x r 0x r3 x x * halt r4 x x * halt r5 x x * halt

Primarily test
Test whether entered number is a prime or not.

LittlePeng9's answer
0 1 1 l 1 0 _ _ r 0 1 _ _ l 2 2 _ 1 l 3 3 _ 1 r 4 4 x x l 4 4 1 x r 5 4 _ _ r 8 5 x x r 5 5 _ _ r 6 6 x x r 6 6 1 x l 7 6 _ _ l 11 7 x x l 7 7 _ _ l 4 8 * 1 r 8 8 _ _ r 9 9 x x r 9 9 1 1 l 10 9 _ _ l 14 10 x x l 10 10 _ _ l 4 11 x 1 l 11 11 _ _ l 12 12 * * l 12 12 _ 1 r 8 13 * * r 13 13 _ _ l 14 14 * _ l 15 14 _ 1 * halt 15 * * l 15 15 _ _ l 16 16 * * l 16 16 _ _ r 17 17 * _ r 18 17 _ _ * halt 18 * * r 18 18 _ _ r 13 Two color variant 0 1 1 l s1 s1 _ _ l s2 s2 _ 1 l s3 s3 _ _ l 1 s0 1 _ l 1 s0 _ 1 r 10 1 _ 1 r 2 2 _ _ r 3 3 1 1 r 3 3 _ _ r 4 4 1 1 r 4 4 _ _ l 5 5 1 _ r 6 5 _ 1 l 15 6 _ 1 l 7 7 _ _ l 8 8 1 1 l 8 8 _ _ l 9 9 1 1 l 9 9 _ _ r s0 10 _ 1 r 14 10 1 1 l 11 11 1 _ l 11 11 _ 1 l 12 12 1 1 l 12 12 _ _ r 13 13 1 _ r s0 14 1 1 r 14 14 _ _ l 18 15 1 1 l 15 15 _ 1 l 16 16 1 1 l 16 16 _ _ r 17 17 1 _ r s0 18 1 _ l 19 19 1 _ l c4 c0 1 1 l c0 c0 _ _ r c1 c1 1 _ r c2 c1 _ _ r c6 c2 1 1 r c2 c2 _ _ r c3 c3 1 1 r c3 c3 _ _ l c4 c4 1 _ l c5 c4 _ 1 r halt c5 1 1 l c5 c5 _ _ l c0 c6 1 _ r c6 c6 _ _ r halt LittlePeng9 (talk) 11:07, April 7, 2013 (UTC)

Calculator
Simulate a pocket calculator. It should at least support 0123456789=+-×. Order of operations and floating-point arithmetic are optional.

Float root
Compute \(\sqrt{n}\) to infinite precision. That is, the Turing machine should continue adding digits of precision as it runs infinitely.

Arbitrary root
Compute m-ractic (m-th power) root of given n.

LittlePeng9's answer
Input is simply strings of n and m 1's separated by blank. Output is equal to \(\lfloor \sqrt[m]{n} \rfloor\) 0 1 1 r 0 0 _ x r s0 0a 1 _ r 1 1 1 _ r 2 1 _ _ r 10 1 x _ r 11 2 * * r 2 2 _ _ r 3 3 1 _ r 4 3 x _ l 8 4 1 1 r 4 4 _ x r 5 4 x x r 5 5 1 1 r 5 5 _ 1 l 6 6 1 1 l 6 6 * * l 7 7 1 1 l 7 7 _ 1 r 3 8 1 1 l 8 8 x x l 8 8 _ x l 9 9 1 1 l 8 9 _ _ r 10 10 x _ r 1 11 1 1 r 11 11 x _ r 11 11 _ _ l 12 12 1 1 l 12 12 _ _ r m0 m0 1 _ r m1 m0 _ _ r m9 m1 1 1 r m1 m1 _ _ r m2 m2 1 _ r m3 m2 _ _ l m7 m3 1 1 r m3 m3 _ _ r m4 m4 1 1 r m4 m4 _ 1 l m5 m5 1 1 l m5 m5 _ _ l m6 m6 1 1 l m6 m6 _ 1 r m2 m7 1 1 l m7 m7 _ _ l m8 m8 1 1 l m8 m8 _ _ r m0 m9 1 _ r m9 m9 _ 1 r 13 13 1 1 r 13 13 _ _ l 14 14 1 _ l 15 15 1 1 l 15 15 _ 1 l 16 16 1 1 r 17 16 _ _ r 13 16 x _ r 18 17 1 _ l 12 18 1 1 r 18 18 _ _ l 19 19 1 _ l c1 s0 1 1 r s0 s0 _ _ r s1 s1 _ 1 r s2 s1 1 1 l s3 s2 _ 1 l s3 s3 * * l s3 s3 x _ r d0 d0 1 x r d1 d0 _ _ r d5 d1 1 1 r d1 d1 _ _ r d2 d2 1 1 r d2 d2 _ _ r d3 d3 _ 1 l d4 d3 1 1 r d3 d4 * * l d4 d4 x x r d0 d5 1 x r d6 d5 _ x r 0a d6 1 1 r d6 d6 _ _ r d7 d7 1 1 r d7 d7 _ _ r d8 d8 _ 1 l d9 d8 1 1 r d8 d9 * * l d9 d9 x x r d5 c0 1 * r c0 c0 x x r c5 c0 _ _ l c1 c1 1 _ l c2 c1 _ 1 l f0 c2 * * l c2 c2 _ * l c3 c3 1 * l c3 c3 _ 1 r c4 c3 x x l c2 c4 1 _ r c5 c4 _ _ l h0 c5 1 * r c5 c5 x x r c5 c5 _ _ r c0 f0 x 1 l f0 f0 _ _ l f1 f1 x 1 l f0 f1 1 1 l f1 f1 _ 1 l f2 f2 1 1 l f2 f2 _ _ r f3 f3 1 _ r 0 h0 1 _ l h0 h0 _ _ r h1 h1 _ _ r h1 h1 x _ r h2 h2 x _ r h2 h2 _ _ r h3 h3 x 1 r h3 h3 _ _ r h4 h4 1 _ r h4 h4 _ _ l h5 h5 * * l h5 h5 1 _ l halt I'm not sure why, but this machine doesn't work for square roots.

LittlePeng9 (talk) 19:09, April 9, 2013 (UTC)

String subsequence
Determine whether the one sequence of strings is a subsequence of other (arbitrary number of types of symbols).

LittlePeng9's answer
Example input: to check if 132 is subsequence of 21233132 replace number 1 in every string with '1', every 2 with '11', every 3 with '111' and leave blanks between them. Input is first string followed by 2 blanks and second string. Output is character under halted machine head (1 if it is subsequence, blank otherwise) ; Example input: 132 and 21233132 -> 1 111 11 11 1 11 111 111 1 111 11 0 1 x r 1 0 _ _ r 10 1 _ _ r 2 1 * * r 1 2 1 1 r 1 2 _ _ r 3 3 _ _ r 3 3 x x r 4 4 x x r 4 3 1 x l 6 4 1 x l 5 4 _ _ r 4a 4a _ _ l halt 4a 1 1 l 4b 4b _ _ l 7 5 x x l 5 5 _ _ l 6 6 * * l 6 6 x x r 0 7 x _ l 7 7 _ _ l 8 8 * * l 8 8 x 1 l 9 9 x 1 l 9 9 _ _ r 0 9 1 _ r 0 10 * * r 10 10 x _ r 11 11 x _ r 11 11 1 _ r 12 11 _ _ l 13 12 1 _ r 12 12 _ _ r 12a 12a 1 1 l 8 12a _ _ l halt 13 * * l 13 13 x x l 14 14 x x l 14 14 _ _ r 15 14 1 _ r 15 15 x _ r 15 15 _ 1 r 16 16 1 x r 1 16 _ _ l halt LittlePeng9 (talk) 10:49, April 6, 2013 (UTC)

Boolean expressions
Compute arbitrary expression in Boolean logic-language.

LittlePeng9's answer
Expression A is balanced iff: 1. A is either T or F 2. A=~B for balanced B or 3. A=(B) for balanced B or 4. A=(B*C) for balanced B and C (take care about parenthesis) where * represents one of binary operators - and (&), or (|), implies (>), is implied (<), xor (+), iff/xnor (-). Valid input is balanced expression with X's at both ends. Output is truth value of that expression. 0 X X r 0' 0' * * r 0' 0' ~ ~ r 1 0' X _ l 15 1 _ _ r 1 1 ( ( r 0' 1 ~ ~ r 1 1 T F l 7 1 F T l 7 0' ) _ l 2 2 * * l 2 2 ( _ l 6 2 | _ r 3 2 & _ r 8 2 > _ l 9 2 < _ r 11 2 - _ l 13 2 + _ l 14 3 _ _ r 3 3 F _ l 5 3 T T l 4 4 _ _ l 4 4 * _ l 5 5 * * l 5 5 ( _ l 6 6 * * l 6 6 X X r 0' 7 * * l 7 7 ~ _ l 6 8 _ _ r 8 8 T _ l 5 8 F F l 4 9 _ _ l 9 9 T _ l 5 9 F T r 10 10 _ _ r 10 10 * _ l 5 11 _ _ r 11 11 T _ l 5 11 F T l 12 12 _ _ l 12 12 * _ l 5 13 _ _ l 13 13 T _ l 5 13 F ~ l 5 14 _ _ l 14 14 F _ l 5 14 T ~ l 5 15 * * l 15 15 X _ r halt

Friedman string
Detect whether the given string is Friedman string (they are described in the block subsequence theorem article).

Graham's problem
Compute the exact solution of Graham's problem that currently bounded by \(13 \leq N \leq 2 \uparrow\uparrow\uparrow (2 \uparrow\uparrow\uparrow 262153)\).

n(k) function
Compute n(k) for given n.

Goodstein function
Compute G(n) for given n.

TREE function
Compute TREE(n) for given n.

Bird's array notation
Compute arbitrary expression in Bird's array notation.

SCG function
Compute SCG(n) for given n.

Loader's D(n) function
Compute D(n) for given n.