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-5 of 5 results.

A372869 Decimal expansion of the number whose continued fraction coefficients are given in A084580.

Original entry on oeis.org

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

Views

Author

Jwalin Bhatt, Jul 04 2024

Keywords

Examples

			0.5815803358828329856145006072280655247763056696200923013621215551576710...
		

Crossrefs

Cf. A084580 (continued fraction).

Programs

  • Python
    # Using `sample_gauss_kuzmin_distribution` function from A084580.
    from mpmath import mp, iv
    def decimal_from_cf(coeffs):
        num = iv.mpf([coeffs[-1], coeffs[-1]+1])
        for coeff in coeffs[-2::-1]:
            num = coeff + 1/iv.mpf(num)
        return 1/num
    def get_matching_digits(interval_a, interval_b):
        match_index = 0
        for i, j in zip(interval_a, interval_b):
            if i != j:  break
            match_index += 1
        return interval_a[:match_index]
    def compute_kuzmin_digits(prec, num_coeffs):
        assert prec > num_coeffs
        mp.dps = iv.dps = prec
        coeffs = sample_gauss_kuzmin_distribution(num_coeffs)
        x = decimal_from_cf(coeffs)
        a = mp.nstr(mp.mpf(x.a), n=prec, strip_zeros=False)
        b = mp.nstr(mp.mpf(x.b), n=prec, strip_zeros=False)
        return get_matching_digits(a, b)
    num = compute_kuzmin_digits(prec=200, num_coeffs=180)
    A372869 = [int(d) for d in num[1:] if d != '.']

A381522 Sequence where k is appended after every k^2 occurrences of 1, with multiple values following a 1 listed in order.

Original entry on oeis.org

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, 5, 1, 1, 3, 1, 2, 1, 1, 1, 1, 2, 4, 1, 1, 1, 1, 2, 3, 6, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 3, 1, 1, 1, 2, 4, 1, 7, 1, 5, 1, 1, 2, 1, 1, 3, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 3, 1, 2, 4, 8, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 3, 6
Offset: 1

Views

Author

Jwalin Bhatt, Feb 26 2025

Keywords

Comments

The frequencies of the terms follow the zeta distribution with parameter value 2.
The geometric mean approaches exp(-zeta'(2)/zeta(2)) A381456 in the limit. In general, if the sequence was formed by every k^s occurrences, it would approach e^(-zeta'(s)/zeta(s)).
Considered as an irregular triangle, the n-th row lists the divisors of the square root of the largest square dividing n.

Examples

			After every 4 ones we see a 2, after every 9 ones we see a 3 and so on.
		

Crossrefs

Programs

  • PARI
    lista(n)={my(L=List()); for(n=1, n, fordiv(sqrtint(n/core(n)), d, listput(L,d))); Vec(L[1..n])} \\ Andrew Howroyd, Feb 26 2025
  • Python
    from itertools import islice
    def zeta_distribution_generator():
        num_ones, num_reached = 0, 1
        while num_ones := num_ones+1:
            yield 1
            for num in range(2, num_reached+2):
                if num_ones % (num*num) == 0:
                    yield num
                    num_reached += num == num_reached+1
    A381522 = list(islice(zeta_distribution_generator(), 120))
    

A084579 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 m in order by n.

Original entry on oeis.org

1, 2, 1, 3, 4, 1, 2, 5, 6, 7, 1, 3, 8, 2, 9, 4, 10, 1, 11, 12, 5, 13, 3, 1, 14, 2, 6, 15, 16, 17, 7, 4, 18, 1, 19, 8, 20, 2, 21, 3, 9, 22, 5, 23, 1, 24, 10, 25, 26, 6, 11, 27, 2, 28, 4, 1, 29, 12, 30, 3, 31, 7, 13, 32, 33, 34, 14, 1, 35, 5, 8, 36, 2, 15, 37, 38, 39, 16, 40, 9, 4, 41, 1, 17, 3
Offset: 1

Views

Author

Paul D. Hanna, May 31 2003

Keywords

Crossrefs

A084581 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 n when k=1.

Original entry on oeis.org

1, 2, 4, 5, 8, 9, 10, 13, 15, 17, 19, 20, 22, 25, 28, 29, 30, 33, 35, 37, 39, 42, 44, 46, 48, 49, 52, 54, 57, 59, 61, 64, 65, 66, 69, 72, 75, 76, 77, 79, 82, 86, 88, 90, 92, 93, 96, 97, 100, 103, 104, 107, 108, 111, 113, 115, 119, 122, 124, 125, 126, 129, 131, 134, 136
Offset: 1

Views

Author

Paul D. Hanna, May 31 2003

Keywords

Crossrefs

A241773 A sequence constructed by greedily sampling the Gauss-Kuzmin distribution log_2[(i+1)^2/(i^2+2*i)] to minimize discrepancy.

Original entry on oeis.org

1, 2, 3, 1, 4, 1, 5, 2, 1, 6, 1, 7, 1, 2, 3, 1, 8, 1, 9, 2, 1, 4, 1, 10, 1, 3, 2, 1, 11, 1, 2, 5, 1, 12, 1, 3, 1, 2, 4, 1, 13, 1, 2, 6, 1, 14, 1, 3, 1, 2, 15, 1, 16, 1, 2, 4, 1, 3, 1, 5, 7, 1, 2, 1, 17, 1, 2, 3, 1, 18, 1, 8, 2, 1, 4, 1, 6, 1, 2, 3, 1, 5, 1, 19
Offset: 1

Views

Author

Jonathan Deane, Apr 28 2014

Keywords

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

Examples

			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)
		

Crossrefs

Programs

  • 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 *)
  • Python
    from fractions import Fraction
    def prob_count_diff(j, k, count):
        return  - ((1 - Fraction(1,(j+1)*(j+1)))**k) * (2**count)
    def sample_pdf(n):
        coeffs, unreached_val, counts = [], 1, {}
        for k in range(1, n+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_pdf(120)  # Jwalin Bhatt, Feb 09 2025
Showing 1-5 of 5 results.