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

A332342 Table T(n, k) read by antidiagonals upwards: sum of the terms of the continued fraction for the fractional part of n/k (n>=1, k>=1).

Original entry on oeis.org

0, 0, 2, 0, 0, 3, 0, 2, 3, 4, 0, 0, 0, 2, 5, 0, 2, 3, 4, 4, 6, 0, 0, 3, 0, 4, 3, 7, 0, 2, 0, 4, 5, 2, 5, 8, 0, 0, 3, 2, 0, 3, 5, 4, 9, 0, 2, 3, 4, 5, 6, 5, 5, 6, 10, 0, 0, 0, 0, 4, 0, 5, 2, 3, 5, 11, 0, 2, 3, 4, 4, 6, 7, 5, 6, 6, 7, 12, 0, 0, 3, 2, 5, 3, 0, 4, 6, 4, 6, 6, 13
Offset: 1

Views

Author

Andrey Zabolotskiy, Feb 10 2020

Keywords

Examples

			2/7 = 1/(3+1/2), so T(2, 7) = 3 + 2 = 5.
The table begins:
0 2 3 4 5 6 7 8 9 ...
0 0 3 2 4 3 5 4 6 ...
0 2 0 4 4 2 5 5 3 ...
0 0 3 0 5 3 5 2 6 ...
0 2 3 4 0 6 5 5 6 ...
0 0 0 2 5 0 7 4 3 ...
...
		

Crossrefs

Programs

  • Mathematica
    t[n_,k_] := Total@ ContinuedFraction@ FractionalPart[n/k];
    Flatten[Table[t[nk+k-1,k], {nk,10}, {k,nk}]]
  • Python
    def cofr(p, q):
        return [] if q == 0 else [p // q] + cofr(q, p % q)
    def t(n, k):
        return sum(cofr(n, k)[1:])
    tr = []
    for nk in range(1, 20):
        for k in range(1, nk+1):
            tr.append(t(nk+1-k, k))
    print(tr)

A071915 Number of 1's in the continued fraction expansion of (3/2)^n.

Original entry on oeis.org

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

Views

Author

Benoit Cloitre, Jun 13 2002

Keywords

Comments

It seems that lim n ->infinity a(n)/n = 0.2... << (log(4)-log(3))/log(2) = 0.415... the expected density of 1's (cf. measure theory of continued fraction).

Examples

			The continued fraction of (3/2)^24 is [16834, 8, 1, 10, 2, 25, 1, 3, 1, 1, 57, 6] which contains 4 "1's", hence a(24)=4.
		

Crossrefs

Programs

  • Mathematica
    a[1] = 0; a[n_] := Count[ContinuedFraction[(3/2)^n], 1]; Array[a, 100] (* Amiram Eldar, Sep 05 2020 *)
  • PARI
    for(n=1,200,s=contfrac(frac((3/2)^n)); print1(sum(i=1,length(s),if(1-component(s,i),0,1)),","))
Showing 1-2 of 2 results.