Skip to content

Instantly share code, notes, and snippets.

@davidsharp
Created December 17, 2021 10:23
Show Gist options
  • Save davidsharp/eeb1e6e1a060ace3a16c3e7706fbaf3e to your computer and use it in GitHub Desktop.
Save davidsharp/eeb1e6e1a060ace3a16c3e7706fbaf3e to your computer and use it in GitHub Desktop.
Finds triangular number (or x + x-1 + x-2, etc down to 0)
const fn = x => x + (x * ((x-1)/2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment