Mean - Median Map

Write a module that takes any list of values and returns the next value defined by the mean-median map.

nextVal[vals_]:=Module[{n=Length[vals],next},
next=(n+1)*Median[vals]-Total[vals];
next   (* this is the return value *)
]

Test this on some sequences:

nextVal[{7,2}]

nextVal[{7,2,9/2}]

Now try a sequence of length 3:

nextVal[{1,2,3}]

nextVal[{1,2,3,2}]

nextVal[{3,2,7}]

nextVal[{3,2,7,0}]

nextVal[{3,2,7,0,1/2}]

Write a module that returns the sequence of some length starting with a list of values.

computeSeq[vals_,num_]:=Module[{next, newvals=vals},
Do[
next=nextVal[newvals];
AppendTo[newvals,next],
num
];
newvals
]

Try it out:

computeSeq[{3,2,7},100]

ListPlot[%]