3 ms·
My favorite turning complete language is Fractran - https://en.wikipedia.org/wiki/FRACTRAN https://en.wikipedia.org/wiki/FRACTRAN 17 78 19 23 29 77 95 77
by shagie 2y ago
My favorite turning complete language is Fractran - https://en.wikipedia.org/wiki/FRACTRAN https://en.wikipedia.org/wiki/FRACTRAN
17 78 19 23 29 77 95 77 1 11 13 15 1 55
-- -- -- -- -- -- -- -- -- -- -- -- -- --
91 85 51 38 33 29 23 19 17 13 11 2 7 1
That computes prime numbers.
Iterate through the list (start with n = 2) and iterate through until the fraction is an integer. Repeat with the new number.
For this, after 2, the next value is 15 (when it gets to 15/2). Then it will be 825 (15 * 55/1). Then it will be 725 (825 * 29 / 33) and so on. At some point, n will be 2^x where the sequence of when the number is just a power of 2 will be: 2^2, 2^3, 2^5, 2^7, 2^11 and so on... the exponents of 2 are the prime sequence.
2, 15, 825, 725, 1925, 2275, 425, 390, 330, 290, 770, 910, 170, 156, 132, 116, 308, 364, 68, 4, 30 ...
https://oeis.org/A007542 https://oeis.org/A007542
https://news.ycombinator.com/item?id=35966537 https://news.ycombinator.com/item?id=35966537
https://softwareengineering.stackexchange.com/questions/220188/why-is-fractran-turing-complete https://softwareengineering.stackexchange.com/questions/2201...
https://web.archive.org/web/20150923211455/http://www.cs.vu.nl/~diem/publications/slides/fractran-2011-05-31.pdf https://web.archive.org/web/20150923211455/http://www.cs.vu....