Check type of an integer
APL (Dyalog Extended), 130 119 bytesSBCS



Anonymous tacit prefix function.

((∊∘⎕A⊂⊢)'FactorialSquareTriangularCubePositiveNegativePrimeComposite')/⍨{⍵∊¨(⊂∘!,×⍨⍮+\)⍳|⍵},(|∊⍳∘|*3⍨),&lt;,&gt;,1∘⍭,0∘⍭∧1∘&lt;


Try it online!

(…)/⍨ filters the list of strings on the left by the bit mask on the right:

 (…)'Fac…ite' apply the following tacit function to the long string:

  ∊∘⎕A element-wise membership of the uppercase alphabet

  ⊂ partitions (i.e. True begins a new partition)

  ⊢ the unmodified argument

The last 46 bytes return a bit vector indicating [Factorial, Square, Triangular, Cube, Positive, Negative, Prime, Composite]:

{⍵∊¨(⊂∘!,×⍨⍮+\)⍳|⍵},(|∊⍳∘|*3⍨),&lt;,&gt;,1∘⍭,0∘⍭∧1∘&lt;


Try it online!

{…} the first three bits (factorial, square, triangular) come from this anonymous lambda:

 ⍵∊¨(…)… is the argument a member of each of the following three lists?

  ⊂∘! the enclosed factorials

  , followed by

  ×⍨ the squares (lit. the multiplication selfies)

  ⍮ juxtaposed with

  +\ the running sum

 ⍳ of the integers one through

 |⍵ the absolute value of the argument

(…) the next bit (cube) comes from the following tacit function:

 | is the absolute value of the argument

 ∊ a member of

 ⍳∘| the integers 1 through the absolute value of the argument

 * raised to the power of

 3⍨ three

&lt; the next bit is simply whether it is positive (zero is less than)

&gt; the next bit is simply whether it is negative (zero is more than)

1∘⍭ the next bit is whether it is prime

0∘⍭ the final bit is whether it is non-prime

∧

1∘&lt; one is less than it