Skip to main content
Commonmark migration
Source Link

APL (Dyalog), 6 bytes

⊢∊+\∘⍳

Try it online!

###Explanation

Explanation

⊢∊+\∘⍳
      ⍳                 Creates a range from 1 to the right_argument
  +\                    Cumulative sum of this range; 1 1+2 1+2+3 .. 1+2+..+n. These are the triangular numbers
⊢∊                      Does the right argument belong to this list of integers in this cumulative sum

Outputs 0 for false and 1 for true.

APL (Dyalog), 6 bytes

⊢∊+\∘⍳

Try it online!

###Explanation

⊢∊+\∘⍳
      ⍳                 Creates a range from 1 to the right_argument
  +\                    Cumulative sum of this range; 1 1+2 1+2+3 .. 1+2+..+n. These are the triangular numbers
⊢∊                      Does the right argument belong to this list of integers in this cumulative sum

Outputs 0 for false and 1 for true.

APL (Dyalog), 6 bytes

⊢∊+\∘⍳

Try it online!

Explanation

⊢∊+\∘⍳
      ⍳                 Creates a range from 1 to the right_argument
  +\                    Cumulative sum of this range; 1 1+2 1+2+3 .. 1+2+..+n. These are the triangular numbers
⊢∊                      Does the right argument belong to this list of integers in this cumulative sum

Outputs 0 for false and 1 for true.

added 374 characters in body
Source Link
user41805
  • 13.2k
  • 6
  • 42
  • 88

APL (Dyalog), 6 bytes

⊢∊+\∘⍳

Try it online!

###Explanation

⊢∊+\∘⍳
      ⍳                 Creates a range from 1 to the right_argument
  +\                    Cumulative sum of this range; 1 1+2 1+2+3 .. 1+2+..+n. These are the triangular numbers
⊢∊                      Does the right argument belong to this list of integers in this cumulative sum

Outputs 0 for false and 1 for true.

APL (Dyalog), 6 bytes

⊢∊+\∘⍳

Try it online!

APL (Dyalog), 6 bytes

⊢∊+\∘⍳

Try it online!

###Explanation

⊢∊+\∘⍳
      ⍳                 Creates a range from 1 to the right_argument
  +\                    Cumulative sum of this range; 1 1+2 1+2+3 .. 1+2+..+n. These are the triangular numbers
⊢∊                      Does the right argument belong to this list of integers in this cumulative sum

Outputs 0 for false and 1 for true.

Source Link
user41805
  • 13.2k
  • 6
  • 42
  • 88

APL (Dyalog), 6 bytes

⊢∊+\∘⍳

Try it online!