%I #6 Mar 05 2026 16:55:19
%S 1,2,1,1,3,1,1,2,1,1,4,1,2,1,1,1,2,1,3,1,1,2,1,1,5,1,2,1,1,3,1,1,2,1,
%T 1,4,1,2,1,1,1,2,1,3,1,1,2,1,1,6,1,1,2,1,3,1,1,2,1,1,1,2,1,4,1,1,2,1,
%U 3,1,1,2,1,1,1,2,1,3,1,1,5,1,2,1,1,1,2
%N A sequence constructed by greedily sampling the discrete probability distribution p(k)=zeta(k+1)-1 to minimize discrepancy.
%C The geometric mean approaches Product_{k>=2} k^(zeta(k+1)-1) = 1.40665264499... in the limit.
%H Jwalin Bhatt, <a href="/A393793/b393793.txt">Table of n, a(n) for n = 1..10000</a>
%H William J. Keith, <a href="https://math.colgate.edu/~integers/k19/k19.Abstract.html">Sequences of Density zeta(K) - 1</a>, INTEGERS, Vol. 10 (2010), Article #A19, pp. 233-241. Also <a href="https://arxiv.org/abs/0905.3765">arXiv preprint</a>, arXiv:0905.3765 [math.NT], 2009 and <a href="http://www.math.drexel.edu/~keith/ZetaKMinusOne.pdf">author's copy</a>.
%e 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 We subtract the actual occurrences c(k) from the expected occurrences and pick the one with the highest value.
%e | n | n*p(1) - c(1) | n*p(2) - c(2) | n*p(3) - c(3) | choice |
%e |---|---------------|---------------|---------------|--------|
%e | 1 | 0.645 | - | - | 1 |
%e | 2 | 0.289 | 0.404 | - | 2 |
%e | 3 | 0.934 | -0.393 | 0.246 | 1 |
%e | 4 | 0.579 | -0.191 | 0.329 | 1 |
%e | 5 | 0.224 | 0.010 | 0.411 | 3 |
%t probCountDiff[j_, k_, count_] := k*(Zeta[j+1] -1) - Lookup[count, j, 0]
%t samplePDF[n_] := Module[{coeffs, unreachedVal, counts, k, probCountDiffs, mostProbable},
%t coeffs = ConstantArray[0, n]; unreachedVal = 1; counts = <||>;
%t Do[probCountDiffs = Table[probCountDiff[i, k, counts], {i, 1, unreachedVal}];
%t mostProbable = First@FirstPosition[probCountDiffs, Max[probCountDiffs]];
%t If[mostProbable == unreachedVal, unreachedVal++]; coeffs[[k]] = mostProbable;
%t counts[mostProbable] = Lookup[counts, mostProbable, 0] + 1; , {k, 1, n}]; coeffs]
%t A393793 = samplePDF[120]
%o (Python)
%o from sympy import zeta
%o def prob_count_diff(j, k, count):
%o return k*(zeta(j+1)-1) - count
%o def sample_zeta_distribution(num_coeffs):
%o coeffs, unreached_val, counts = [], 1, {}
%o for k in range(1, num_coeffs+1):
%o prob_count_diffs = [prob_count_diff(i, k, counts.get(i, 0)) for i in range(1, unreached_val+1)]
%o most_probable = prob_count_diffs.index(max(prob_count_diffs)) + 1
%o unreached_val += most_probable == unreached_val
%o coeffs.append(most_probable)
%o counts[most_probable] = counts.get(most_probable, 0) + 1
%o return coeffs
%o A393793 = sample_zeta_distribution(120)
%Y Cf. A393663.
%K nonn
%O 1,2
%A _Jwalin Bhatt_, Feb 27 2026