login
A385873
A sequence constructed by greedily sampling the Poisson distribution for parameter value 1 so as to minimize discrepancy.
1
1, 2, 1, 3, 1, 2, 1, 1, 2, 1, 1, 2, 1, 3, 1, 2, 1, 1, 2, 1, 4, 1, 2, 1, 1, 2, 1, 3, 1, 2, 1, 1, 2, 1, 3, 1, 2, 1, 1, 2, 1, 1, 2, 1, 3, 1, 2, 1, 1, 2, 1, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 1, 2, 1, 1, 3, 2, 1, 1, 2, 1, 1, 2, 1, 3, 1, 2, 1, 1, 2, 1, 5, 1, 2, 1, 1, 2, 1, 3, 1, 2, 1, 1, 2, 1, 1, 2, 1, 3, 1, 2, 1, 1, 2, 1, 4
OFFSET
1,2
COMMENTS
The geometric mean approaches A385686 = exp((Sum_{k>=2} log(k)/k!)/(e-1)) in the limit.
The Poisson distribution used here is p(i) = 1/((e-1)*i!).
EXAMPLE
Let p(k) denote the probability of k and c(k) denote the number of occurrences of k among the first n-1 terms; then the expected number of occurrences of k among n random terms is 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.581 | 0.290 | 0.096 | 1 |
| 2 | 0.163 | 0.581 | 0.193 | 2 |
| 3 | 0.745 | -0.127 | 0.290 | 1 |
| 4 | 0.327 | 0.163 | 0.387 | 3 |
| 5 | 0.909 | 0.454 | -0.515 | 1 |
MATHEMATICA
probCountDiff[j_, k_, count_]:=N[k/((E-1)*Factorial[j])]-Lookup[count, j, 0]
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]
A385873=samplePDF[120]
PROG
(Python)
from mpmath import iv
def prob_count_diff(j, k, count):
return k/((iv.e-1)*iv.factorial(j)) - count
def sample_poisson_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
A385873 = sample_poisson_distribution(120) # Jwalin Bhatt, Dec 16 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Jwalin Bhatt, Jul 11 2025
STATUS
approved