Skip to content

Instantly share code, notes, and snippets.

@OutThisLife
Created October 25, 2018 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OutThisLife/6b615dfca0fd82149b18be60b5c211aa to your computer and use it in GitHub Desktop.
Save OutThisLife/6b615dfca0fd82149b18be60b5c211aa to your computer and use it in GitHub Desktop.
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