cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

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.

Original entry on oeis.org

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

Views

Author

Paul D. Hanna, May 31 2003

Keywords

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

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)
		

Crossrefs

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

A386009 Decimal expansion of Product_{k>=2} k^( ((k/2)^(k-1)) / (exp(k/2)*k!) ).

Original entry on oeis.org

1, 5, 4, 9, 2, 5, 1, 0, 4, 3, 4, 2, 5, 6, 3, 4, 0, 4, 8, 4, 0, 0, 5, 4, 4, 0, 2, 8, 1, 5, 8, 9, 4, 3, 5, 5, 5, 3, 0, 8, 8, 3, 5, 2, 6, 7, 0, 1, 5, 8, 3, 6, 8, 5, 4, 7, 2, 3, 3, 4, 6, 6, 4, 9, 5, 4, 7, 2, 2, 4, 6, 5, 2, 1, 8, 3, 3, 4, 7, 1, 6, 1, 9, 4, 2
Offset: 1

Views

Author

Jwalin Bhatt, Jul 14 2025

Keywords

Comments

The geometric mean of the Borel distribution with parameter value 1/2 (A386016) approaches this constant. In general, for parameter value p it approaches Product_{k>=2} k^(((p*k)^(k-1))/((e^(p*k))*k!)).

Examples

			1.549251043425634048400544028158943555...
		

Crossrefs

Cf. A386016.

Programs

  • Mathematica
    Exp[NSum[((k/2)^(k-1) * Log[k])/(E^(k/2) * Factorial[k]), {k, 2, Infinity}, WorkingPrecision -> 120, NSumTerms -> 1000]]

Formula

Equals exp( Sum_{k>=2} log(k) * (((k/2)^(k-1)) / (exp(k/2)*k!)) ).

A386904 A sequence constructed by greedily sampling the Borel distribution for parameter value 1/2 to minimize discrepancy.

Original entry on oeis.org

1, 2, 1, 1, 3, 1, 4, 1, 2, 1, 1, 5, 1, 2, 1, 1, 3, 1, 1, 2, 1, 6, 1, 1, 2, 1, 1, 3, 1, 2, 1, 4, 1, 1, 2, 1, 1, 7, 1, 2, 1, 3, 1, 1, 8, 1, 2, 1, 1, 5, 1, 2, 1, 1, 3, 1, 1, 2, 1, 4, 1, 1, 2, 1, 3, 1, 1, 2, 1, 1, 9, 1, 2, 1, 1, 4, 1, 3, 1, 2, 1, 1, 6, 1, 2, 1, 1, 1, 3, 1, 2, 1, 5, 1, 1, 2, 1, 1, 4, 1, 2, 1, 3, 1, 1, 2, 1, 1, 10
Offset: 1

Views

Author

Jwalin Bhatt, Aug 07 2025

Keywords

Comments

The geometric mean approaches A386009 in the limit.
The Borel distribution with parameter value 1/2 has PDF p(i) = (i/2)^(i-1) / (exp(i/2)*i!).

Examples

			Let p(k) denote the probability of k and c(k) denote the count of occurrences of k so far, then the expected occurrences of k at n-th step are given by n*p(k).
We subtract the actual occurrences c(k) 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.606     |       -       |       -       |   1    |
| 2 |     0.213     |     0.367     |       -       |   2    |
| 3 |     0.819     |    -0.448     |     0.251     |   1    |
| 4 |     0.426     |    -0.264     |     0.334     |   1    |
| 5 |     0.032     |    -0.080     |     0.418     |   3    |
		

Crossrefs

Programs

  • Mathematica
    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]
    A386904=samplePDF[120]
Showing 1-3 of 3 results.