s=0; for n=1:2:101 s=s+n^2; if s>2000 k=(n+1)/2; break; end end [k n s]