OFFSET
1,2
COMMENTS
Let the sequence be A = {a(i)}, i = 1, 2, 3,... and define p(i) =
log_2[(i+1)^2/(i^2+2*i)]. Additionally, define u(j, k) = k*p(j) - N(j, k), where N(j, k) is the number of occurrences of j in {a(i)}, i = 1,..., k-1. Refer to the first argument of u as the "index" of u. Then A is defined by a(1) = 1 and, for i > 1, a(i) = m, where m is the index of the maximal element of the set {u(j, i)}, j = 1, 2, 3,... That there is a single maximal element for all i is guaranteed by the fact that p(i) - p(j) is irrational for all i not equal to j.
Interpreting sequence A as the partial coefficients of the continued fraction expansion of a real number C, say, then C = 1.44224780173510148... which is, by construction, normal (in the continued fraction sense).
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. - Jwalin Bhatt, Feb 11 2025
LINKS
Jonathan Deane, Table of n, a(n) for n = 1..10000
D. Bailey, J. Borwein, and R. Crandall, On the Khintchine constant, Mathematics of Computation 66:217 (January 1997), pp. 417-431.
Jonathan Deane, An integer sequence whose members obey a given p.d.f.
Wikipedia, Gauss-Kuzmin distribution
EXAMPLE
Example from Jwalin Bhatt, Jun 10 2025: (Start)
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).
We subtract the actual occurrences c(n) from the expected occurrences and pick the one with the highest value.
| n | n*p(1) - c(1) | n*p(2) - c(2) | n*p(3) - c(3) | choice |
|---|---------------|---------------|---------------|--------|
| 1 | 0.415 | 0.169 | 0.093 | 1 |
| 2 | -0.169 | 0.339 | 0.186 | 2 |
| 3 | 0.245 | -0.490 | 0.279 | 3 |
| 4 | 0.660 | -0.320 | -0.627 | 1 |
(End)
MAPLE
pdf := i -> -log[2](1 - 1/(i+1)^2);
gen_seq := proc(n)
local i, j, N, A, u, mm, ndig;
ndig := 40; N := 'N';
for i from 1 to n do N[i] := 0; end do;
A := 'A'; A[1] := 1; N[1] := 1;
for i from 2 to n do
u := 'u';
for j from 1 to n do
u[j] := i*pdf(j) - N[j];
end do;
mm := max_maxind(evalf(convert(u, list), ndig));
if mm[3] then
A[i] := mm[1];
N[mm[1]] := N[mm[1]] + 1;
else
return();
end if;
end do;
return(convert(A, list));
end:
max_maxind := proc(inl)
local uniq, mxind, mx, i;
uniq := `true`;
if nops(inl) = 1 then return([1, inl[1], uniq]); end if;
mxind := 1; mx := inl[1];
for i from 2 to nops(inl) do
if inl[i] > mx then
mxind := i;
mx := inl[i];
uniq := `true`;
elif inl[i] = mx then
uniq := `false`;
end if;
end do;
return([mxind, mx, uniq]);
end:
gen_seq(100);
MATHEMATICA
probCountDiff[j_, k_, count_] := k*-Log[2, 1 - (1/((j + 1)^2))] - Lookup[count, j, 0]
samplePDF[n_] := Module[{coeffs, unreachedVal, counts, k, probCountDiffs, mostProbable},
coeffs = ConstantArray[0, n]; unreachedVal = 1; counts = <||>;
Do[probCountDiffs = Table[probCountDiff[i, k, counts], {i, 1, unreachedVal}];
mostProbable = First@FirstPosition[probCountDiffs, Max[probCountDiffs]];
If[mostProbable == unreachedVal, unreachedVal++]; coeffs[[k]] = mostProbable;
counts[mostProbable] = Lookup[counts, mostProbable, 0] + 1; , {k, 1, n}]; coeffs]
A241773 = samplePDF[120] (* Jwalin Bhatt, Jun 04 2025 *)
PROG
(Python)
from mpmath import iv
log2 = iv.log(2)
def prob_count_diff(j, k, count):
return k*-iv.log(1-(iv.mpf(1)/((j+1)*(j+1))))/log2 - count
def sample_gauss_kuzmin_distribution(num_coeffs):
coeffs, unreached_val, counts = [], 1, {}
for k in range(1, num_coeffs+1):
prob_count_diffs = [prob_count_diff(i, k, counts.get(i, 0)) for i in range(1, unreached_val+1)]
most_probable = prob_count_diffs.index(max(prob_count_diffs)) + 1
unreached_val += most_probable == unreached_val
coeffs.append(most_probable)
counts[most_probable] = counts.get(most_probable, 0) + 1
return coeffs
A241773 = sample_gauss_kuzmin_distribution(120) # Jwalin Bhatt, Dec 01 2025
CROSSREFS
KEYWORD
cofr,easy,nonn
AUTHOR
Jonathan Deane, Apr 28 2014
STATUS
approved
