A386016 A sequence constructed by greedily sampling the Borel distribution for parameter value 1/2 to minimize ratio discrepancy.
1, 1, 1, 2, 1, 1, 1, 2, 1, 3, 1, 1, 2, 1, 1, 1, 1, 2, 4, 1, 3, 1, 1, 2, 1, 1, 1, 2, 1, 1, 3, 1, 5, 1, 2, 1, 1, 1, 2, 4, 1, 1, 3, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 6, 3, 2, 1, 1, 1, 2, 1, 4, 1, 1, 2, 1, 3, 1, 1, 5, 1, 2, 1, 1, 1, 2, 1, 3, 1, 1, 2, 1, 4, 1, 1, 7
Offset: 1
Examples
Let p(k) denote the probability of k and c(k) denote the count of occurrences of k so far. We take the ratio of the actual occurrences c(k)+1 to the probability and pick the one with the lowest value. Since p(k) is monotonic decreasing, we only need to compute c(k) once we see c(k-1). | n | (c(1)+1)/p(1) | (c(2)+1)/p(2) | (c(3)+1)/p(3) | choice | |---|---------------|---------------|---------------|--------| | 1 | 1.648 | - | - | 1 | | 2 | 3.297 | 5.436 | - | 1 | | 3 | 4.946 | 5.436 | - | 1 | | 4 | 6.594 | 5.436 | - | 2 | | 5 | 6.594 | 10.873 | 11.951 | 1 |
Links
- Jwalin Bhatt, Table of n, a(n) for n = 1..10000
- Wikipedia, Borel distribution
Programs
-
Mathematica
pdf[i_] := ((i/2)^(i - 1))/((E^(i/2)) * Factorial[i]) samplePDF[numCoeffs_] := Module[ {coeffs = {}, counts = {0}, minTime, minIndex, time}, Do[ minTime = Infinity; Do[ time = (counts[[i]] + 1)/pdf[i]; If[time < minTime, minIndex = i; minTime = time], {i, 1, Length[counts]} ]; If[minIndex == Length[counts], AppendTo[counts, 0]]; counts[[minIndex]] += 1; AppendTo[coeffs, minIndex], {numCoeffs} ]; coeffs ] A386016 = samplePDF[120]
Comments