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.
%I A386904 #16 Aug 22 2025 17:19:56 %S A386904 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, %T A386904 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, %U A386904 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 %N A386904 A sequence constructed by greedily sampling the Borel distribution for parameter value 1/2 to minimize discrepancy. %C A386904 The geometric mean approaches A386009 in the limit. %C A386904 The Borel distribution with parameter value 1/2 has PDF p(i) = (i/2)^(i-1) / (exp(i/2)*i!). %H A386904 Jwalin Bhatt, <a href="/A386904/b386904.txt">Table of n, a(n) for n = 1..10000</a> %H A386904 Wikipedia, <a href="https://en.wikipedia.org/wiki/Borel_distribution">Borel distribution</a> %e A386904 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 A386904 We subtract the actual occurrences c(k) from the expected occurrences and pick the one with the highest value. %e A386904 | n | n*p(1) - c(1) | n*p(2) - c(2) | n*p(3) - c(3) | choice | %e A386904 |---|---------------|---------------|---------------|--------| %e A386904 | 1 | 0.606 | - | - | 1 | %e A386904 | 2 | 0.213 | 0.367 | - | 2 | %e A386904 | 3 | 0.819 | -0.448 | 0.251 | 1 | %e A386904 | 4 | 0.426 | -0.264 | 0.334 | 1 | %e A386904 | 5 | 0.032 | -0.080 | 0.418 | 3 | %t A386904 samplePDF[n_]:=Module[{coeffs, unreachedVal, counts, k, probCountDiffs, mostProbable}, %t A386904 coeffs=ConstantArray[0, n]; unreachedVal=1; counts=<||>; %t A386904 Do[probCountDiffs=Table[probCountDiff[i, k, counts], {i, 1, unreachedVal}]; %t A386904 mostProbable=First@FirstPosition[probCountDiffs, Max[probCountDiffs]]; %t A386904 If[mostProbable==unreachedVal, unreachedVal++]; coeffs[[k]]=mostProbable; %t A386904 counts[mostProbable]=Lookup[counts, mostProbable, 0]+1; , {k, 1, n}]; coeffs] %t A386904 A386904=samplePDF[120] %Y A386904 Cf. A386009, A386016. %K A386904 nonn,new %O A386904 1,2 %A A386904 _Jwalin Bhatt_, Aug 07 2025