cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A383238 A sequence constructed by greedily sampling the Poisson distribution for parameter value 1, 1/(e*(i-1)!) to minimize discrepancy selecting the smallest value in case of ties.

This page as a plain text file.
%I A383238 #29 Jul 24 2025 18:24:20
%S A383238 1,2,3,1,2,4,1,2,3,1,2,1,2,3,1,2,5,1,2,3,1,2,1,2,3,4,1,2,1,2,3,1,2,1,
%T A383238 2,3,1,2,4,1,2,3,1,2,1,2,3,1,2,1,2,3,1,2,4,1,2,3,1,2,1,2,3,1,2,1,2,3,
%U A383238 1,2,4,1,2,3,1,2,1,2,3,1,2,5,1,2,3,1,2,4,1,2,3,1,2,1,2,3,1,2,1,2,3,1,2,4,1,2,3,1,2,1,2,3,1,2,6,1,2,3,1,2
%N A383238 A sequence constructed by greedily sampling the Poisson distribution for parameter value 1, 1/(e*(i-1)!) to minimize discrepancy selecting the smallest value in case of ties.
%C A383238 The geometric mean approaches A382095 = exp(Sum_{k>=2} log(k)/(k-1)!) in the limit.
%H A383238 Jwalin Bhatt, <a href="/A383238/b383238.txt">Table of n, a(n) for n = 1..10000</a>
%H A383238 Wikipedia, <a href="https://en.wikipedia.org/wiki/Poisson_distribution">Poisson distribution</a>
%e A383238 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).
%e A383238 We subtract the actual occurrences c(k) from the expected occurrences and pick the one with the highest value.
%e A383238 | n | n*p(1) - c(1) | n*p(2) - c(2) | n*p(3) - c(3) | choice |
%e A383238 |---|---------------|---------------|---------------|--------|
%e A383238 | 1 |     0.367     |     0.367     |     0.183     |   1    |
%e A383238 | 2 |    -0.264     |     0.735     |     0.367     |   2    |
%e A383238 | 3 |     0.103     |     0.103     |     0.551     |   3    |
%e A383238 | 4 |     0.471     |     0.471     |    -0.264     |   1    |
%e A383238 | 5 |    -0.160     |     0.839     |    -0.080     |   2    |
%t A383238 probCountDiff[j_,k_,count_]:=N[k/(E*Factorial[j-1])]-Lookup[count,j,0]
%t A383238 samplePDF[n_]:=Module[{coeffs,unreachedVal,counts,k,probCountDiffs,mostProbable},
%t A383238   coeffs=ConstantArray[0,n];unreachedVal=1;counts=<||>;
%t A383238   Do[probCountDiffs=Table[probCountDiff[i,k,counts],{i,1,unreachedVal}];
%t A383238     mostProbable=First@FirstPosition[probCountDiffs,Max[probCountDiffs]];
%t A383238     If[mostProbable==unreachedVal,unreachedVal++];coeffs[[k]]=mostProbable;
%t A383238     counts[mostProbable]=Lookup[counts,mostProbable,0]+1;,{k,1,n}];coeffs]
%t A383238 A383238=samplePDF[120]
%Y A383238 Cf. A381617, A382093, A382095, A382961.
%K A383238 nonn
%O A383238 1,2
%A A383238 _Jwalin Bhatt_, Apr 20 2025