A FRACTRAN interpreter, in honour of John Horton Conway.
Prerequisites:
- A recent-ish installaction of node.
- Babel (if you prefer) https://babeljs.io/docs/en/usage
Installing Babel to compile ES-whatever to node-whatever:
npm install --save-dev @babel/core @babel/cli @babel/preset-env
npm install --save @babel/polyfill
Print an infinite list of primes using a big integer implementation:
npx babel src --out-dir lib && node ./lib/integer-primes.js
=> 2
3
5
7
11
13
17
19
23
29
...
Or limit the number of primes:
npx babel src --out-dir lib && node ./lib/integer-primes.js 7
=> 2
3
5
7
11
13
17
Or compute an arbitrary fibonacci number:
npx babel src --out-dir lib && node ./lib/integer-fib.js 7
=> fib(7) = 13