Step-by-step explanation:
Lets use arithmetic progression
so S= n(2a₁ + (n-1)d /2 assuming common difference is 1
so sum must be greater than 500
⇒n² +n /2 >500
⇒n² + n >1000
⇒n² + n -1000>0
For the algorithm
For int n =1 to ∞ ,
if n² + n -1000<0
then continue
else print (n)