User:Thebigh/mysandbox: Difference between revisions
Content added Content deleted
(...actually, THIS is the simplest program (:) |
(→Integer Sequence: -concise is good) |
||
Line 15:
==Integer Sequence==
Given the number 1 as input the following program will, as its (3n-2)th step, produce the number 2^n.
<lang fractran>
==Sort three variables==
|
Revision as of 16:05, 23 November 2021
Some FRACTRAN programs in case we ever have a category for it
A+B
Input a number of the form 2^a 3^b <lang fractran> {2/3} </lang> The output is 2^(a+b)
Empty program
A list of no fractions does nothing, then immediately stops. <lang fractran>{}</lang>
Integer Sequence
Given the number 1 as input the following program will, as its (3n-2)th step, produce the number 2^n. <lang fractran> {2/3, 9/2, 2/1}</lang>
Sort three variables
FRACTRAN's only data type is positive integers. Suppose (a,b,c) are the integers to be sorted. Give the following as input: 2^a 3^b 5^c <lang fractran> {1001/30, 143/6, 143/10, 143/15, 13/2, 13/3, 13/5} </lang> Returns 7^A 11^B 13^C where (A,B,C) are (a,b,c) in ascending order.