@unwind: thanks for the tip! I was wrong in some places, and the documentation led me on the right track.
In fact, a prediction is a piece of cake when you know a sequence of 30 (or so) numbers. The "calculated" answer will be correct in 50% of cases. More detailed information is provided in the link provided by the unwinding, or in a simplified code: http://www.mathstat.dal.ca/~selinger/random/
source share