Skip to content

Instantly share code, notes, and snippets.

@noghartt
Last active July 20, 2025 21:51
Show Gist options
  • Save noghartt/aba21541b6d986669d8614af30e13e1b to your computer and use it in GitHub Desktop.
Save noghartt/aba21541b6d986669d8614af30e13e1b to your computer and use it in GitHub Desktop.
A small utility function to map from Godel numbering into Typographical Number Theory (for GEB readers)
const table = {
666: "0",
123: "S",
111: "=",
112: "+",
236: " x ",
362: "(",
323: ")",
212: "<",
213: ">",
312: "[",
313: "]",
262: "a",
163: "'",
161: " ^ ",
616: " v ",
633: " -> ",
223: "~",
333: "∃",
626: "∀",
611: "punc."
}
/** @param {Array<number>} godelNumber */
const stringifyGodelNumber = (godelNumber) => {
if (!Array.isArray(godelNumber)) {
throw new TypeError("Input must be an array of numbers.");
}
return godelNumber.map(num => {
const str = table[num];
if (!str) {
throw new Error(`Godel number ${num} not found in table.`);
}
return str;
}).join("");
}
(() => {
const before = stringifyGodelNumber([
// 362, 262, 112, 262, 163, 323, 111, 123, 123, 123, 123, 666
223, 362, 262, 236, 262, 323, 111, 262, 163
]);
const after = stringifyGodelNumber([
// 362, 123, 123, 666, 112, 123, 123, 123, 666, 323, 111, 123, 123, 123, 123, 666
223, 362, 123, 666, 236, 123, 666, 323, 111, 262, 163
]);
console.log("Before:", before);
console.log("After:", after);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment