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.

A381617 A sequence constructed by greedily sampling the zeta distribution for parameter value 2 to minimize discrepancy.

This page as a plain text file.
%I A381617 #45 Aug 17 2025 20:18:04
%S A381617 1,2,1,1,3,1,4,1,1,2,1,1,5,1,2,1,1,6,1,3,1,1,2,1,7,1,1,8,1,2,1,1,4,1,
%T A381617 3,1,2,1,1,1,9,1,2,1,1,10,1,2,1,1,3,1,5,1,1,2,1,11,1,1,4,1,2,1,1,3,1,
%U A381617 1,2,1,12,1,1,13,1,2,1,1,3,1,6,1,2,1,1,1,4,1,2,1,1,14
%N A381617 A sequence constructed by greedily sampling the zeta distribution for parameter value 2 to minimize discrepancy.
%C A381617 The geometric mean approaches exp(-zeta'(2)/zeta(2)) = A381456 in the limit.
%C A381617 The zeta distribution PDF is p(i) = 1/(zeta(2)*i^2).
%H A381617 Jwalin Bhatt, <a href="/A381617/b381617.txt">Table of n, a(n) for n = 1..10000</a>
%H A381617 Wikipedia, <a href="https://en.wikipedia.org/wiki/Zeta_distribution">Zeta distribution</a>
%e A381617 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 A381617 We subtract the actual occurrences c(k) from the expected occurrences and pick the one with the highest value.
%e A381617 | n | n*p(1) - c(1) | n*p(2) - c(2) | n*p(3) - c(3) | choice |
%e A381617 |---|---------------|---------------|---------------|--------|
%e A381617 | 1 |     0.607     |       -       |       -       |   1    |
%e A381617 | 2 |     0.215     |     0.303     |       -       |   2    |
%e A381617 | 3 |     0.823     |    -0.544     |     0.202     |   1    |
%e A381617 | 4 |     0.431     |    -0.392     |     0.270     |   1    |
%e A381617 | 5 |     0.039     |    -0.240     |     0.337     |   3    |
%t A381617 probCountDiff[j_, k_, count_] := k/(Zeta[2] j^2) - Lookup[count, j, 0]
%t A381617 samplePDF[n_] := Module[{coeffs, unreachedVal, counts, k, probCountDiffs, mostProbable},
%t A381617   coeffs = ConstantArray[0, n]; unreachedVal = 1; counts = <||>;
%t A381617   Do[probCountDiffs = Table[probCountDiff[i, k, counts], {i, 1, unreachedVal}];
%t A381617     mostProbable = First@FirstPosition[probCountDiffs, Max[probCountDiffs]];
%t A381617     If[mostProbable == unreachedVal, unreachedVal++]; coeffs[[k]] = mostProbable;
%t A381617     counts[mostProbable] = Lookup[counts, mostProbable, 0] + 1;, {k, 1, n}]; coeffs]
%t A381617 A381617 = samplePDF[120]
%Y A381617 Cf. A241773, A381522.
%K A381617 nonn
%O A381617 1,2
%A A381617 _Jwalin Bhatt_, Mar 10 2025