><>, 3030 28 bytes
-2 bytes thanks to lanlock4
Assumes input is on the stack. Outputs either a 1
or 0
.
1v0v
<+1~v1<~v!?(}:{:,2*+1::+
;n=n={<<;
This was fun. I'm new to ><>, and I'd welcome any suggestions for golfing.
This starts with n=1
, then continually increments n
while n(n-1)/2
is less than the input number. Once the loop terminates, it prints 1
if n(n-1)/2
is equal to the input number, 0
otherwise.