First, write the equation for the sum of the arithmetic progression with difference d=1 and the first element a1=1:
S=2n[2a1+(n−1)d]=2n2+n. The sum must be greater than 500:
2n2+n>500, transform the inequality:
n2+n−1000>0.
Algorithm:
for int n=1 to infinity:
if n^2+n-1000<0,
then continue
else print(n)
Draw the flow diagram:
