A084580 Let y = m/GK(k), where m and k vary over the positive integers and GK(k)=log(1+1/(k*(k+2)))/log(2) is the Gauss-Kuzmin distribution of k. Sort the y values by size and number them consecutively by n. This sequence gives the values of k in order by n.
1, 1, 2, 1, 1, 3, 2, 1, 1, 1, 4, 2, 1, 3, 1, 2, 1, 5, 1, 1, 2, 1, 3, 6, 1, 4, 2, 1, 1, 1, 2, 3, 1, 7, 1, 2, 1, 5, 1, 4, 2, 1, 3, 1, 8, 1, 2, 1, 1, 3, 2, 1, 6, 1, 4, 9, 1, 2, 1, 5, 1, 3, 2, 1, 1, 1, 2, 10, 1, 4, 3, 1, 7, 2, 1, 1, 1, 2, 1, 3, 5, 1, 11, 2, 6, 1, 4, 1, 2, 1, 3, 1, 1, 8, 2, 1, 1, 12, 2, 1, 3, 4, 1, 1
Offset: 1
Keywords
Examples
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 | 5.884 | - | - | 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)
Links
- Jwalin Bhatt, Table of n, a(n) for n = 1..10000
- Wikipedia, Gauss Kuzmin distribution
Programs
-
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 *)
-
Python
import math def sample_gauss_kuzmin_distribution(num_coeffs): coeffs, counts = [], [0] for _ in range(num_coeffs): min_time = math.inf for i, count in enumerate(counts, start=1): time = (count+1) / -math.log2(1-(1/((i+1)**2))) 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
Comments