Skip to main content
4 of 4
added 171 characters in body
Tbw
  • 3k
  • 4
  • 29

APL(Dyalog Unicode), 10 98 bytes SBCS

⊢∊+\⍣2⍤⍳ 

Try it on APLgolf!

-1 byte thanks to att.

A tacit function which takes an integer on the right and returns 1 if tetrahedral and 0 if not. Same method as the Vyxal and Uiua answers.

⊢∊+\⍣2⍤⍳­⁡​‎‎⁡⁠⁢⁤‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁤‏⁠‎⁡⁠⁢⁡‏‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁢⁢‏⁠‎⁡⁠⁢⁣‏‏​⁡⁠⁡‌⁤​‎‎⁡⁠⁡‏⁠‎⁡⁠⁢‏‏​⁡⁠⁡‌­ ⍤⍳ # ‎⁡range, then +\ # ‎⁢cumulative sums, ⍣2 # ‎⁣twice ⊢∊ # ‎⁤input is member 💎 

Created with the help of Luminespire.

Tbw
  • 3k
  • 4
  • 29