###
**Problem:**

Given a number N. N is considered special if for any positive integer i, N=(i*(i+1))/2. Print "YES" if N is special number, else print "NO"

###
**Input Format:**

N

###
**Output Format:**

YES/NO###
**Constraints:**

None### Sample Input

210

### Sample Output:

YES### Explanations:

for i=20,(20*21)/2=210. So 210 is special number
Solution:

$c=sqrt((8*$n)+1);

if($c == int($c))

{

print "YES";

}

else

{

print "NO";

}

### Tips:

Solving maths equation, you can narrow down to check if 8N+1 is a perfect square.

## No comments:

## Post a Comment