User:Thebigh/mysandbox: Difference between revisions
Content added Content deleted
(more) |
(→Sort three variables: -expand) |
||
Line 16: | Line 16: | ||
==Sort three variables== |
==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: |
|||
⚫ | |||
<lang fractran> |
<lang fractran> |
||
⚫ | |||
{1001/30, 143/6, 143/10, 143/15, 13/2, 13/3, 13/5} |
{1001/30, 143/6, 143/10, 143/15, 13/2, 13/3, 13/5} |
||
</lang> |
</lang> |
Revision as of 22:16, 22 November 2021
Some FRACTRAN programs in case we ever have a category for it
Integer Sequence
<lang fractran> 1 {2/3, 9/2, 2/1}</lang>
- Output:
2^0 2^1 3^2 2 x 3 2^2 2 x 3^2 2^2 x 3 2^3 ...
Regarding only the powers of two, we get 1,2,4,8,16, etc.
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.