Question: using a foor loop to select a certain element from a list?

I have been trying to to get a loop to sum the elements of a list of n size, and then take a certain element of summen list (which meets) a certain condition. And then print it out. 

What I can get it to do is printing the input list, and summing the elements in a new sister list sequence. And then if I for instance want its to print the element in testseq which is less than 15. Then it instead prints all elements less than 15 in testseq. What I would like to do is to move the index, so it only prints 10 and save it to a constant? 

So what am I missing?

test := [1, 2, 3, 4, 5, 6, 7, 10];
               test := [1, 2, 3, 4, 5, 6, 7, 10]


testseq := [seq(sum(test[i], i = 1 .. j), j = 1 .. numelems(test))];
            testseq := [1, 3, 6, 10, 15, 21, 28, 38]

for i to nops(test) while testseq[i] < 15 do
    testseq[i];
end do;
                               1

                               3

                               6

                               10

Please Wait...