Truncated triangular number
A common property of triangular numbers is that they can be arranged in a triangle. For instance, take 21 and arrange into a triangle of
o o o o o o o o o o o o o o o o o o o o o
Let's define a "truncation:" cutting triangles of the same size from each corner. One way to truncate 21 is as follows:
. . . o o o o o o o . o o o . . . o o . .
(The triangles of
. are cut from the original).
There are 12
os remaining, so 12 is a truncated triangle number.
Your job is to write a program or a function (or equivalent) that takes an integer and returns (or use any of the standard output methods) whether a number is a truncated triangle number.
- No standard loopholes.
- The input is a non-negative integer.
- A cut cannot have a side length exceeding the half of that of the original triangle (i.e. cuts cannot overlap)
- A cut can have side length zero.
0 1 3 6 7 10 12 15 18 19
2 4 5 8 9 11 13 14 16 17 20
Test cases for all integers up to 50: TIO Link
This is code-golf, so submissions with shortest byte counts in each language win!