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.

A245327 Numerators in recursive bijection from positive integers to positive rationals, where the bijection is f(1) = 1, f(2n) = 1/(f(n)+1), f(2n+1) = f(n)+1.

Original entry on oeis.org

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

Views

Author

Yosu Yurramendi, Jul 18 2014

Keywords

Comments

a(n)/A245328(n) enumerates all the reduced nonnegative rational numbers exactly once.
If the terms (n>0) are written as an array (left-aligned fashion) with rows of length 2^m, m = 0,1,2,3,...
1,
1, 2,
2, 3,1, 3,
3, 5,2, 5,3, 4,1, 4,
5, 8,3, 8,5, 7,2, 7,4, 7,3, 7,4,5,1,5,
8,13,5,13,8,11,3,11,7,12,5,12,7,9,2,9,7,11,4,11,7,10,3,10,5,9,4,9,5,6,1,6,
then the sum of the m-th row is 3^m (m = 0,1,2,), and each column k is a Fibonacci sequence.
If the rows are written in a right-aligned fashion:
1,
1,2,
2,3,1,3,
3,5,2,5,3,4,1,4,
5, 8,3, 8,5, 7,2, 7,4,7,3,7,4,5,1,5,
8,13,5,13,8,11,3,11,7,12,5,12,7,9,2,9,7,11,4,11,7,10,3,10,5,9,4,9,5,6,1,6,
then each column is an arithmetic sequence.
If the sequence is considered by blocks of length 2^m, m = 0,1,2,..., the blocks of this sequence are permutations of terms of blocks from A002487 (Stern's diatomic series or Stern-Brocot sequence), and, more precisely, the reverses of blocks of A020650 ( a(2^m+k) = A020650(2^(m+1)-1-k), m = 0,1,2,..., k = 0,1,2,...,2^m-1).
Moreover, each block is the bit-reversed permutation of the corresponding block of A245325.

Crossrefs

Programs

  • Mathematica
    f[n_] := Which[n == 1, 1, EvenQ@ n, 1/(f[n/2] + 1), True, f[(n - 1)/2] + 1]; Table[Numerator@ f@ k, {n, 7}, {k, 2^(n - 1), 2^n - 1}] // Flatten (* Michael De Vlieger, Mar 02 2017 *)
  • PARI
    a(n) = my(A=0); forstep(i=logint(n, 2), 0, -1, if(bittest(n, i), A++, A=1/(A+1))); numerator(A) \\ Mikhail Kurkov, Mar 12 2023
  • R
    N  <- 25 # arbitrary
    a <- c(1,1,2)
    for(n in 1:N){
      a[4*n]   <-          a[2*n+1]
      a[4*n+1] <- a[2*n] + a[2*n+1]
      a[4*n+2] <- a[2*n]
      a[4*n+3] <- a[2*n] + a[2*n+1]
    }
    a
    

Formula

a(2n) = A245328(2n+1) , a(2n+1) = A245328(2n) , n=0,1,2,3,...
a((2*n+1)*2^m - 2) = A273493(n), n > 0, m > 0. For n = 0, m > 0, A273493(0) = 1 is needed. For n = 1, m = 0, A273493(0) = 1 is needed. For n > 1, m = 0, numerator((2*n-1) = num+den(n-1). - Yosu Yurramendi, Mar 02 2017
a(n) = A002487(A284459(n)). - Yosu Yurramendi, Aug 23 2021

A245328 Denominators in recursive bijection from positive integers to positive rationals (the bijection is f(1) = 1, f(2n) = 1/(f(n)+1), f(2n+1) = f(n)+1).

Original entry on oeis.org

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

Views

Author

Yosu Yurramendi, Jul 18 2014

Keywords

Comments

A245327(n)/a(n) enumerates all the reduced nonnegative rational numbers exactly once.
If the terms (n>0) are written as an array (left-aligned fashion) with rows of length 2^m, m = 0,1,2,3,...
1,
2,1,
3,2, 3,1,
5,3, 5,2, 4,3, 4,1,
8,5, 8,3, 7,5, 7,2, 7,4, 7,3,5,4,5,1,
13,8,13,5,11,8,11,3,12,7,12,5,9,7,9,2,11,7,11,4,10,7,10,3,9,5,9,4,6,5,6,1,
then the sum of the m-th row is 3^m (m = 0,1,2,), and each column k is a Fibonacci sequence.
If the rows are written in a right-aligned fashion:
1,
2,1,
3,2,3,1,
5,3,5,2,4,3,4,1,
8,5, 8,3, 7,5, 7,2,7,4,7,3,5,4,5,1,
13,8,13,5,11,8,11,3,12,7,12,5,9,7,9,2,11,7,11,4,10,7,10,3,9,5,9,4,6,5,6,1,
then each column is an arithmetic sequence. The differences of the arithmetic sequences, except the first on the right, give the sequence A093873 (Numerators in Kepler's tree of harmonic fractions) (a(2^(m+1)-1-k) - a(2^m-1-k) = A093873(k), m = 0,1,2,..., k = 0,1,2,...,2^m-1).
If the sequence is considered by blocks of length 2^m, m = 0,1,2,..., the blocks of this sequence are permutations of terms of blocks from A002487 (Stern's diatomic series or Stern-Brocot sequence), and, more precisely, the reverses of blocks of A020651 ( a(2^m+k) = A020651(2^(m+1)-1-k), m = 0,1,2,..., k = 0,1,2,...,2^m-1).
Moreover, each block is the bit-reversed permutation of the corresponding block of A245326.

Crossrefs

Programs

  • Mathematica
    f[n_] := Which[n == 1, 1, EvenQ@ n, 1/(f[n/2] + 1), True, f[(n - 1)/2] + 1]; Table[Denominator@ f@ k, {n, 7}, {k, 2^(n - 1), 2^n - 1}] // Flatten (* Michael De Vlieger, Mar 02 2017 *)
  • PARI
    a(n) = my(A=0); forstep(i=logint(n, 2), 0, -1, if(bittest(n, i), A++, A=1/(A+1))); denominator(A) \\ Mikhail Kurkov, Mar 12 2023
  • R
    N <- 25 # arbitrary
    a <- c(1,2,1)
    for(n in 1:N){
      a[4*n]   <- a[2*n] + a[2*n+1]
      a[4*n+1] <- a[2*n]
      a[4*n+2] <- a[2*n] + a[2*n+1]
      a[4*n+3] <-          a[2*n+1]
    }
    a
    

Formula

a(2n) = A245327(2n+1) , a(2n+1) = A245328(2n) , n=1,2,3,...
a((2*n+1)*2^m - 1) = A273493(n), n > 0, m >= 0. For n = 0 A273493(0) = 1 is needed. - Yosu Yurramendi, Mar 02 2017
a(n) = A002487(1+A284459(n)). - Yosu Yurramendi, Aug 23 2021

A273494 a(n) = A245325(n) + A245326(n).

Original entry on oeis.org

2, 3, 3, 5, 4, 5, 4, 8, 7, 7, 5, 8, 7, 7, 5, 13, 11, 12, 9, 11, 10, 9, 6, 13, 11, 12, 9, 11, 10, 9, 6, 21, 18, 19, 14, 19, 17, 16, 11, 18, 15, 17, 13, 14, 13, 11, 7, 21, 18, 19, 14, 19, 17, 16, 11, 18, 15, 17, 13, 14, 13, 11, 7, 34, 29, 31, 23, 30, 27, 25, 17, 31, 26, 29, 22, 25, 23, 20, 13, 29, 25, 26, 19, 27, 24, 23, 16, 23
Offset: 1

Views

Author

Yosu Yurramendi, May 23 2016

Keywords

Comments

The terms (n>0) may be written as a left-justified array with rows of length 2^m, m >= 0:
2,
3, 3,
5, 4, 5, 4,
8, 7, 7, 5, 8, 7, 7, 5,
13,11,12, 9,11,10, 9, 6,13,11,12, 9,11,10, 9, 6,
21,18,19,14,19,17,16,11,18,15,17,13,14,13,11, 7,21,18,19,14,19,17,...
All columns have the Fibonacci sequence property: a(2^(m+2) + k) = a(2^(m+1) + k) + a(2^m + k), m >= 0, 0 <= k < 2^m (empirical observations).
The terms (n>0) may also be written as a right-justified array with rows of length 2^m, m >= 0:
2,
3, 3,
5, 4, 5, 4,
8, 7, 7, 5, 8, 7, 7, 5,
13,11,12, 9,11,10, 9, 6,13,11,12, 9,11,10, 9, 6,
..., 18,15,17,13,14,13,11, 7,21,18,19,14,19,17,16,11,18,15,17,13,14,13,11, 7,
Each column is an arithmetic sequence. The differences of the arithmetic sequences give the sequence A071585: a(2^(m+1)-1-k) - a(2^m-1-k) = A071585(k), m >= 0, 0 <= k < 2^m.
n > 1 occurs in this sequence phi(n) = A000010(n) times, as it occurs in A007306 (Franklin T. Adams-Watters's comment), which is the sequence obtained by adding numerator and denominator in the Calkin-Wilf enumeration system of positive rationals. A245325(n)/A245326(n) is also an enumeration system of all positive rationals, and in each level m >= 0 (ranks between 2^m and 2^(m+1)-1) rationals are the same in both systems. Thus a(n) has the same terms in each level as A007306.
The same property occurs in all numerator+denominator sequences of enumeration systems of positive rationals, as, for example, A007306 (A007305+A047679), A071585 (A229742+A071766), A086592 (A020650+A020651), A268087 (A162909+A162910).

Crossrefs

Programs

  • PARI
    a(n) = my(x=1, y=1); for(i=0, logint(n, 2), if(bittest(n, i), [x, y]=[x+y, y], [x, y]=[y, x+y])); x \\ Mikhail Kurkov, Mar 10 2023

Formula

a(n) = A273493(A059893(n)), a(A059893(n)) = A273493(n), n > 0. - Yosu Yurramendi, May 30 2017
a(n) = A007306(A059893(A180200(n))) = A007306(A059894(A154435(n))). - Yosu Yurramendi, Sep 20 2021
Showing 1-3 of 3 results.