Dear Mark,
is there a special reason why you do not wish to use the Tally command?
Sort[Tally[{1, 1, 3, 2, 1, 0}]]
It is quite fast even if your lists get longer:
Sort[Tally[RandomInteger[5, 1000000]]]
Your solution does not work for several reasons. One is that one of the indices is 0. test[[0]] asks for the Head of test, which is List. This is one reason why you get a funny output. I would not recommend it at all, but
test = {0, 0, 0, 0, 0, 0}
(test[[# + 1]] = test[[# + 1]] + 1) & /@ {1, 1, 3, 2, 1, 0}; test
would work. The list test, would be filled with zeros at the end according to the length of the original field. The semicolon suppresses the output, because the first bit is a very strange way of defining a loop, and you do not want to see the intermediate results. Your output is basically how often the number in the input list has occurred up to that stage, which is not what you want. I also added a "+1" so that you get around the problem of the Head of the list, which is test[[0]]. Something more standard would look like this:
test = {0, 0, 0, 0, 0, 0}; inputsequence = {1, 1, 3, 2, 1, 0};
Do[ test[[inputsequence[[i]] + 1]] =
test[[inputsequence[[i]] + 1]] + 1, {i, 1,
Length[inputsequence]}]; test
Cheers,
Marco