I am not sure if this is possible, plus I am running on no sleep, so here is what I am asking. Assume I have a list of random numbers. In this instance we will have a list containing $[5, 4, 3, 2, 1]$. I want to retain as little data about these numbers as possible in memory and update the average as new numbers get introduced.
So the average of this list of numbers is $\frac{5+4+3+2+1}{5}=3$. If I add another random number to the list, say $6$, it becomes $[6, 5, 4, 3, 2, 1]$. However, let's say we don't know the previous numbers in the list, just the count of them and their average before we append $6$ to the list. Given these details, I can calculate the new average based on just the count and old average.
$\frac{Count * Avg + NewNumber} {Count + 1} = NewAverage$
or $\frac{5 * 3 + 6} {5 + 1} = 3.5$
Simple enough. Now, is it possible to get the average of the past $X$ numbers without actually having a reference to them? I can't think of a better way to express that without it sounding odd or misleading. Assume after calculating the average and getting the count, and any other scalar numerical values, the list of numbers is not retrievable.
Also I am new to this StackExchange so forgive my etiquette and feel free to correct me on it.