Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Building Fizzbuzz in Fractran from the bottom up (malisper.me)
37 points by zeveb on June 16, 2016 | hide | past | favorite | 3 comments


Years ago I participated in a CTF where one of the challenges was to produce Fractran programs that met certain requirements. They were relatively simple-sounding things like computing the nth power of two, but even that is a bit of a pain in Fractran. I initially tried something similar to this article, manually compiling programs that use only the (Turing-complete) JZDEC instruction on paper. Unfortunately, there was a length limitation which made this approach impossible as it did not produce fraction lists nearly as small as one can write by hand. I ended up finding it easier to write a program to brute force all possible Fractran programs under the length limit until one of them had the correct behavior than to actually write useful Fractran code by hand.


That's interesting. How do you brute force all possible Fractran programs when they take natural numbers? Did you have an upper limit like 10,000?


The limit was quite small. There was a relationship between the number of distinct primes you allowed to appear and the number of registers the Turing machine it modeled had, but I don't remember the details. I don't recall the choice of composites being very important. There was a pretty natural limit that was apparent to me at the time but I've long since lost my Fractran intuition.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: