OFFSET
1,3
COMMENTS
The geometric mean of the sequence equals Khintchine's constant K=2.685452001 = A002210 since the frequency of the integers agrees with the Gauss-Kuzmin distribution. When considered as a continued fraction, the resulting constant is 0.5815803358828329856145... = A372869 = [0;1,1,2,1,1,3,2,1,1,1,4,2,1,...].
This can also be defined as the sequence formed by greedily sampling the Gauss-Kuzmin distribution. - Jwalin Bhatt, Nov 28 2024
The sequence is also generated by the D'Hondt (or Jefferson) apportionment method for the given distribution. - Pontus von Brömssen, Mar 30 2026
LINKS
Jwalin Bhatt, Table of n, a(n) for n = 1..10000
Wikipedia, D'Hondt method.
Wikipedia, Gauss Kuzmin distribution.
EXAMPLE
From Jwalin Bhatt, Jul 25 2025: (Start)
Constructing the sequence by greedily sampling the Gauss-Kuzmin distribution to minimize discrepancy.
Let p(n) denote the probability of n and c(n) denote the count of occurrences of n so far.
We take the ratio of the actual occurrences c(n)+1 to the probability and pick the one with the lowest value.
Since p(n) is monotonic decreasing, we only need to compute c(n) once we see c(n-1).
| n | (c(1)+1)/p(1) | (c(2)+1)/p(2) | (c(3)+1)/p(3) | choice |
|---|---------------|---------------|---------------|--------|
| 1 | 2.409 | - | - | 1 |
| 2 | 4.818 | 5.884 | - | 1 |
| 3 | 7.228 | 5.884 | - | 2 |
| 4 | 7.228 | 11.769 | 10.740 | 1 |
| 5 | 9.637 | 11.769 | 10.740 | 1 |
| 6 | 12.047 | 11.769 | 10.740 | 3 | (End)
MATHEMATICA
pdf[k_] := Log[1 + 1/(k*(k + 2))]/Log[2]
samplePDF[numCoeffs_] := Module[
{coeffs = {}, counts = {0}, minTime, minIndex, time},
Do[
minTime = Infinity;
Do[
time = (counts[[i]] + 1)/pdf[i];
If[time < minTime, minIndex = i; minTime = time],
{i, 1, Length[counts]}
];
If[minIndex == Length[counts], AppendTo[counts, 0]];
counts[[minIndex]] += 1;
AppendTo[coeffs, minIndex],
{numCoeffs}
];
coeffs
]
A084580 = samplePDF[120] (* Jwalin Bhatt, Jul 25 2025 *)
PROG
(Python)
from mpmath import iv
log2 = iv.log(2)
def sample_gauss_kuzmin_distribution(num_coeffs):
coeffs, counts = [], [0]
for _ in range(num_coeffs):
min_time = iv.inf
for i, count in enumerate(counts, start=1):
time = (count+1) / -(iv.log(1-(1/((i+1)*(i+1))))/log2)
if time < min_time:
min_index, min_time = i, time
if min_index == len(counts):
counts.append(0)
counts[min_index-1] += 1
coeffs.append(min_index)
return coeffs
A084580 = sample_gauss_kuzmin_distribution(100) # Jwalin Bhatt, Dec 22 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Paul D. Hanna, May 31 2003
STATUS
approved
