login
A386904
A sequence constructed by greedily sampling the Borel distribution for parameter value 1/2 to minimize discrepancy.
3
1, 2, 1, 1, 3, 1, 4, 1, 2, 1, 1, 5, 1, 2, 1, 1, 3, 1, 1, 2, 1, 6, 1, 1, 2, 1, 1, 3, 1, 2, 1, 4, 1, 1, 2, 1, 1, 7, 1, 2, 1, 3, 1, 1, 8, 1, 2, 1, 1, 5, 1, 2, 1, 1, 3, 1, 1, 2, 1, 4, 1, 1, 2, 1, 3, 1, 1, 2, 1, 1, 9, 1, 2, 1, 1, 4, 1, 3, 1, 2, 1, 1, 6, 1, 2, 1, 1, 1, 3, 1, 2, 1, 5, 1, 1, 2, 1, 1, 4, 1, 2, 1, 3, 1, 1, 2, 1, 1, 10
OFFSET
1,2
COMMENTS
The geometric mean approaches A386009 in the limit.
The Borel distribution with parameter value 1/2 has PDF p(i) = (i/2)^(i-1) / (exp(i/2)*i!).
LINKS
EXAMPLE
Let p(k) denote the probability of k and c(k) denote the count of occurrences of k so far, then the expected occurrences of k at n-th step are given by n*p(k).
We subtract the actual occurrences c(k) from the expected occurrences and pick the one with the highest value.
| n | n*p(1) - c(1) | n*p(2) - c(2) | n*p(3) - c(3) | choice |
|---|---------------|---------------|---------------|--------|
| 1 | 0.606 | - | - | 1 |
| 2 | 0.213 | 0.367 | - | 2 |
| 3 | 0.819 | -0.448 | 0.251 | 1 |
| 4 | 0.426 | -0.264 | 0.334 | 1 |
| 5 | 0.032 | -0.080 | 0.418 | 3 |
MATHEMATICA
samplePDF[n_]:=Module[{coeffs, unreachedVal, counts, k, probCountDiffs, mostProbable},
coeffs=ConstantArray[0, n]; unreachedVal=1; counts=<||>;
Do[probCountDiffs=Table[probCountDiff[i, k, counts], {i, 1, unreachedVal}];
mostProbable=First@FirstPosition[probCountDiffs, Max[probCountDiffs]];
If[mostProbable==unreachedVal, unreachedVal++]; coeffs[[k]]=mostProbable;
counts[mostProbable]=Lookup[counts, mostProbable, 0]+1; , {k, 1, n}]; coeffs]
A386904=samplePDF[120]
PROG
(Python)
from mpmath import iv
def prob_count_diff(j, k, count):
return k*(((iv.mpf(j)/2)**(j-1))/(iv.exp(iv.mpf(j)/2)*iv.factorial(j))) - count
def sample_borel_distribution(num_coeffs):
coeffs, unreached_val, counts = [], 1, {}
for k in range(1, num_coeffs+1):
prob_count_diffs = [prob_count_diff(i, k, counts.get(i, 0)) for i in range(1, unreached_val+1)]
most_probable = prob_count_diffs.index(max(prob_count_diffs)) + 1
unreached_val += most_probable == unreached_val
coeffs.append(most_probable)
counts[most_probable] = counts.get(most_probable, 0) + 1
return coeffs
A386904 = sample_borel_distribution(120) # Jwalin Bhatt, Dec 16 2025
CROSSREFS
Sequence in context: A375128 A381617 A396506 * A245717 A248008 A327981
KEYWORD
nonn
AUTHOR
Jwalin Bhatt, Aug 07 2025
STATUS
approved