How to calculate the average of a sequence with more weight toward more frequent values?

30 Views Asked by At

I have a long sequence containing $n$ values like below:

[1,2,1,3,1,1,3,3,1,200,1,1,40,1,....,1]

in which, the majority of the values are smaller than $k$ (unknown), and a few numbers are bigger than $3*k$. I want to filter out those few values in the sequence.

I thought if somehow I can find the average of those frequent values (which are below $k$) then I can use it as a threshold. But I do not know $k$.

Any opinion?