Question: solving sum equation

does anyone see what i'm doing wrong, trying to solve for n

add(length(i), i = 1 .. n) = 2893;

o/p: Error, unable to execute add

fsolve(sum(length(i), i = 1 .. n) = 2893,n=500..2000);

o/p: n=2893

but if i do a procedure i get the right answer: 

s := 0; for i to 5000 do t := length(i); s := s+t; if s <> 2893 then next else print(i) end if end do;

1000

Please Wait...