Created
October 25, 2018 18:36
-
-
Save OutThisLife/6b615dfca0fd82149b18be60b5c211aa to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const set: number[] = [ | |
...Array(1 + (parseInt(process.argv[2], 10) || 10)).keys() | |
] | |
const graph = set | |
.reduce<number[][]>( | |
(acc, i) => (acc[i] = set.filter(j => j)) && acc.sort(), | |
[] | |
) | |
.map(g => g.sort((a, b) => a - b)) | |
console.log( | |
graph.reduce((str, r, i) => { | |
!+i | |
? ((str += '🐤\t'), r.forEach(j => (str += `[${j}]\t`))) | |
: ((str += `[${i}]\t`), r.forEach(j => (str += `${j * i}\t`))) | |
return (str += '\n') | |
}, '') | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment