Skip to content

Instantly share code, notes, and snippets.

@vidul-nikolaev-petrov
Last active December 25, 2016 11:42
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 vidul-nikolaev-petrov/a39801aac01b91c0786dcd13f1496884 to your computer and use it in GitHub Desktop.
Save vidul-nikolaev-petrov/a39801aac01b91c0786dcd13f1496884 to your computer and use it in GitHub Desktop.
New Year tree
console.log(' '.repeat(10), "☆");
for (let i = 1, s = ''; i < 10; i++) {
console.log(' '.repeat(10 - i), `${s += i}=${+s * 8 + i}`);
}
console.log(' '.repeat(9), '_=_');
/**
Based on the eight calculations:
1 * 8 + 1 = 9
12 * 8 + 2 = 98
123 * 8 + 3 = 987
1234 * 8 + 4 = 9876
12345 * 8 + 5 = 98765
123456 * 8 + 6 = 987654
1234567 * 8 + 7 = 9876543
12345678 * 8 + 8 = 98765432
123456789 * 8 + 9 = 987654321
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment