%I #16 Jun 09 2026 00:05:27
%S 1,1,1,1,2,1,1,1,1,2,1,3,1,1,1,2,1,1,1,1,2,4,1,1,3,1,1,2,1,1,1,1,2,1,
%T 1,5,1,3,1,2,1,1,1,1,2,1,4,1,1,1,2,1,3,1,6,1,1,2,1,1,1,1,2,1,1,3,1,1,
%U 2,1,1,4,1,7,1,2,5,1,1,1,3,1,2,1,1,1,1,2
%N A sequence constructed by greedily sampling the probability distribution given by 1/log_2(i+1)^2 - 1/log_2(i+2)^2 to minimize ratio discrepancy.
%C The probability mass function used here is a simple example of a heavy log tail distribution. It can be seen as a discrete analog of the log-Cauchy distribution. As a consequence of the heavy tail, the arithmetic mean of this sequence diverges to infinity but it has a finite geometric mean.
%C A general family of these distributions is given by 1/log_2(i+1)^p - 1/log_2(i+2)^p where p>0.
%C Properties change sharply at p=1, the arithmetic mean remains infinite for all p but the geometric mean becomes finite for p>1 and infinite for p<=1.
%C | mean | 0 < p <= 1 | p > 1 |
%C |------------|------------|--------|
%C | arithmetic | oo | oo |
%C | geometric | oo | finite |
%C The Fisher information is always finite and given by Sum_{i=1..inf} ((ln(log_2(i+2))/(log_2(i+2))^p - ln(log_2(i+1))/(log_2(i+1))^p)^2) / (1/(log_2(i+1))^p - 1/(log_2(i+2))^p).
%C This sequence is generated by the D'Hondt (or Jefferson) apportionment method for the given distribution.
%C The geometric mean equals Product_{i>=1} (1+1/i)^(1/log_2(i+2)^2) = 2.097184811... and for general power p in the family above it equals Product_{i>=1} (1+1/i)^(1/log_2(i+2)^p). - _Jwalin Bhatt_, Jun 03 2026
%H Jwalin Bhatt, <a href="/A396405/b396405.txt">Table of n, a(n) for n = 1..10000</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/D%27Hondt_method">D'Hondt method</a>.
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Log-Cauchy_distribution">Log-Cauchy distribution</a>.
%e Let p(k) denote the probability of k and c(k) denote the count of occurrences of k so far.
%e We take the ratio of the actual occurrences c(k)+1 to the probability and pick the one with the lowest value.
%e Since p(k) is monotonic decreasing, we only need to compute c(k) once we see c(k-1).
%e | n | (c(1)+1)/p(1) | (c(2)+1)/p(2) | (c(3)+1)/p(3) | choice |
%e |---|---------------|---------------|---------------|--------|
%e | 1 | 1.661 | - | - | 1 |
%e | 2 | 3.322 | 6.753 | - | 1 |
%e | 3 | 4.983 | 6.753 | - | 1 |
%e | 4 | 6.645 | 6.753 | - | 1 |
%e | 5 | 8.306 | 6.753 | - | 2 |
%e | 6 | 8.306 | 13.506 | 15.499 | 1 |
%t pdf[i_] := 1/Log2[i+1]^2 - 1/Log2[i+2]^2
%t samplePDF[numCoeffs_] := Module[
%t {coeffs = {}, counts = {0}, minTime, minIndex, time},
%t Do[
%t minTime = Infinity;
%t Do[
%t time = (counts[[i]] + 1)/pdf[i];
%t If[time < minTime, minIndex = i; minTime = time],
%t {i, 1, Length[counts]}
%t ];
%t If[minIndex == Length[counts], AppendTo[counts, 0]];
%t counts[[minIndex]] += 1;
%t AppendTo[coeffs, minIndex],
%t {numCoeffs}
%t ];
%t coeffs
%t ]
%t A396405 = samplePDF[120]
%o (Python)
%o from mpmath import iv
%o def pdf(k):
%o return 1/iv.log(k+1,2)**2 - 1/iv.log(k+2,2)**2
%o def sample_log_tail_distribution(num_coeffs):
%o coeffs, counts = [], [0]
%o for _ in range(num_coeffs):
%o min_time = iv.inf
%o for i, count in enumerate(counts, start=1):
%o time = (count+1) / pdf(i)
%o if time < min_time:
%o min_index, min_time = i, time
%o if min_index == len(counts):
%o counts.append(0)
%o counts[min_index-1] += 1
%o coeffs.append(min_index)
%o return coeffs
%o A396405 = sample_log_tail_distribution(120)
%Y Cf. A393100, A394370, A394401.
%K nonn
%O 1,5
%A _Jwalin Bhatt_, May 24 2026