| Let E(m) = expected # of random selections (from the set {1..k}),
starting with Sum(a(i)) congruent to m modulo n.
Note that the subscripts are all modulo n.
Then
E(0) = 1 + E(1)/k + E(2)/k + ... + E(k)/k (must choose once)
E(1) = 1 + E(2)/k + ... + E(k)/k + E(1+k)/k
...
E(i) = 1 + Sum E(i+j)/k
j=1..k
i+j <> 0 mod n
...
E(n-1) = 1 + E(1)/k + ... E(k-1)/k
Summing both sides of these n equations, we get:
Sum E(i) = n + Sum k* E(i)/k
i=0..n-1 i=0..n-1
i <> 0 mod n
So that
Sum E(i) = n + Sum E(i) - E(0)
i=0..n-1 i=0..n-1
and
E(0) = n
|
| It took me a while, but I finally figured out what you were
saying in .-1. For those who still don't believe that the
expected value is n:
n k
-------
The average of 1000 trials for (10, 2) was 10.222.
The average of 1000 trials for (10, 3) was 9.917.
The average of 1000 trials for (10, 4) was 10.127.
The average of 1000 trials for (10, 5) was 9.763.
The average of 1000 trials for (10, 6) was 9.559.
The average of 1000 trials for (10, 7) was 9.788.
The average of 1000 trials for (10, 8) was 10.247.
The average of 1000 trials for (10, 9) was 10.022.
Try it again, with n prime:
The average of 1000 trials for (13, 2) was 12.975.
The average of 1000 trials for (13, 3) was 13.422.
The average of 1000 trials for (13, 4) was 13.037.
The average of 1000 trials for (13, 5) was 13.035.
The average of 1000 trials for (13, 6) was 13.196.
The average of 1000 trials for (13, 7) was 13.161.
The average of 1000 trials for (13, 8) was 13.038.
The average of 1000 trials for (13, 9) was 14.271.
The average of 1000 trials for (13,10) was 12.752.
The average of 1000 trials for (13,11) was 12.742.
The average of 1000 trials for (13,12) was 13.213.
This n has lots of factors (k is random):
The average of 1000 trials for (36, 4) was 35.313.
The average of 1000 trials for (36,23) was 36.890.
The average of 1000 trials for (36,28) was 36.164.
The average of 1000 trials for (36, 5) was 37.466.
The average of 1000 trials for (36, 4) was 37.087.
Dan
P.S. The variance appears to be rather high.
|