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 A383899 #19 Jul 29 2025 00:18:04 %S A383899 1,2,1,3,1,4,1,2,1,5,1,6,1,2,1,3,1,7,1,2,1,8,1,9,1,2,1,4,1,3,1,2,1,10, %T A383899 1,11,1,2,1,3,1,5,1,2,1,4,1,12,1,2,1,3,1,13,1,2,1,6,1,14,1,2,1,3,1,4, %U A383899 1,2,1,5,1,15,1,2,1,7,1,3,1,2,1,16,1,17 %N A383899 A sequence constructed by greedily sampling the Yule-Simon distribution for parameter value 1, to minimize discrepancy selecting the smallest value in case of ties. %C A383899 The geometric mean approaches A245254 in the limit. %C A383899 The probability mass function of the Yule-Simon distribution with parameter 1 is given by p(k) = 1/(k*(k+1)) for k >= 1. %H A383899 Jwalin Bhatt, <a href="/A383899/b383899.txt">Table of n, a(n) for n = 1..10000</a> %H A383899 Wikipedia, <a href="https://en.wikipedia.org/wiki/Yule%E2%80%93Simon_distribution">Yule-Simon distribution</a> %e A383899 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). %e A383899 We subtract the actual occurrences c(k) from the expected occurrences and pick the one with the highest value. %e A383899 | n | n*p(1) - c(1) | n*p(2) - c(2) | n*p(3) - c(3) | choice | %e A383899 |---|---------------|---------------|---------------|--------| %e A383899 | 1 | 0.5 | 0.166 | 0.083 | 1 | %e A383899 | 2 | 0 | 0.333 | 0.166 | 2 | %e A383899 | 3 | 0.5 | -0.5 | 0.25 | 1 | %e A383899 | 4 | 0 | -0.333 | 0.333 | 3 | %e A383899 | 5 | 0.5 | -0.166 | -0.583 | 1 | %t A383899 probCountDiff[j_, k_, count_]:=k/(j*(j+1))-Lookup[count, j, 0] %t A383899 samplePDF[n_]:=Module[{coeffs, unreachedVal, counts, k, probCountDiffs, mostProbable}, %t A383899 coeffs=ConstantArray[0, n]; unreachedVal=1; counts=<||>; %t A383899 Do[probCountDiffs=Table[probCountDiff[i, k, counts], {i, 1, unreachedVal}]; %t A383899 mostProbable=First@FirstPosition[probCountDiffs, Max[probCountDiffs]]; %t A383899 If[mostProbable==unreachedVal, unreachedVal++]; coeffs[[k]]=mostProbable; %t A383899 counts[mostProbable]=Lookup[counts, mostProbable, 0]+1; , {k, 1, n}]; coeffs] %t A383899 A383899=samplePDF[120] %Y A383899 Cf. A245254, A383855. %K A383899 nonn %O A383899 1,2 %A A383899 _Jwalin Bhatt_, May 14 2025