Created
September 1, 2016 14:43
-
-
Save rahatarmanahmed/27a007d27acbdc023ce8b22f904bf280 to your computer and use it in GitHub Desktop.
ASCII Godel Numbering
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var P = require('livecoding-primes'); | |
function asciiGodelNumber(str) { | |
var primes = P.primes() | |
return str.split('') | |
.map(c => c.codePointAt(0)) | |
.map(n => Math.pow(primes.next().value, n)) | |
.reduce((acc, n) => acc*n, 1) | |
} | |
return asciiGodelNumber('1+1=2') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment