Retina 0.8.2, 26 bytes
.+ $* (^(1)|(?<2>1\2)\1)+$ Try it online! Link includes test cases. Explanation: The first stage just converts to unary; the second stage adds successive triangular numbers to see if this will exactly consume the unary number. The ?<2> syntax reuses capturing group 2; the equivalent in Perl 5 would be something like thisPerl is to use alternative capture group numbering:
Perl 5 -p, 33 bytes
$_=(1x$_)=~/((?|^(1)|(1\2)\1))+$/ Try it online!Try it online! Link is toincludes test suite that outputs 0 or 1 for each line of inputcases.