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-10 of 13 results. Next

A258996 Permutation of the positive integers: this permutation transforms the enumeration system of positive irreducible fractions A002487/A002487' (Calkin-Wilf) into the enumeration system A162911/A162912 (Drib), and vice versa.

Original entry on oeis.org

1, 2, 3, 6, 7, 4, 5, 10, 11, 8, 9, 14, 15, 12, 13, 26, 27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21, 42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37, 58, 59, 56, 57, 62, 63, 60, 61, 50, 51, 48, 49, 54, 55, 52, 53
Offset: 1

Views

Author

Yosu Yurramendi, Jun 16 2015

Keywords

Comments

As A258746 the permutation is self-inverse. Except for fixed points 1, 2, 3 it consists completely of 2-cycles: (4,6), (5,7), (8,10), (9,11), (12,14), (13,15), (16,26), (17,27), ..., (21,31), ..., (32,42), ... . - Yosu Yurramendi, Mar 31 2016
When terms of sequence |n - a(n)|/2 (n > 3) are considered only once, and they are sorted in increasing order, A147992 is obtained. - Yosu Yurramendi, Apr 05 2016

Crossrefs

Cf. A092569, A117120, A258746. Similar R-programs: A332769, A284447.

Programs

  • R
    maxlevel <- 5 # by choice
    a <- 1
    for(m in 0:maxlevel) for(k in 0:(2^m-1)){
      a[2^(m+1) + 2*k    ] = 2*a[2^(m+1) - 1 - k]
      a[2^(m+1) + 2*k + 1] = 2*a[2^(m+1) - 1 - k] + 1}
    a
    
  • R
    # Given n, compute a(n) by taking into account the binary representation of n
    maxblock <- 7 # by choice
    a <- 1:3
    for(n in 4:2^maxblock){
      ones <- which(as.integer(intToBits(n)) == 1)
      nbit <- as.integer(intToBits(n))[1:tail(ones, n = 1)]
      anbit <- nbit
      anbit[seq(2, length(anbit) - 1, 2)] <- 1 - anbit[seq(2, length(anbit) - 1, 2)]
      a <- c(a, sum(anbit*2^(0:(length(anbit) - 1))))
    }
    a
    # Yosu Yurramendi, Mar 30 2021

Formula

a(1) = 1, a(2) = 2, a(3) = 3. For n = 2^m + k, m > 1, 0 <= k < 2^m. If m is even, then a(2^(m+1)+k) = a(2^m + k) + 2^m and a(2^(m+1) + 2^m+k) = a(2^m+k) + 2^(m+1). If m is odd, then a(2^(m+1) + k) = a(2^m+k) + 2^(m+1) and a(2^(m+1) + 2^m+k) = a(2^m+k) + 2^m.
From Yosu Yurramendi, Mar 23 2017: (Start)
A258746(a(n)) = a(A258746(n)), n > 0.
A092569(a(n)) = a(A092569(n)), n > 0.
A117120(a(n)) = a(A117120(n)), n > 0;
A065190(a(n)) = a(A065190(n)), n > 0;
A054429(a(n)) = a(A054429(n)), n > 0;
A063946(a(n)) = a(A063946(n)), n > 0. (End)
a(1) = 1, for m >= 0 and 0 <= k < 2^m, a(2^(m+1) + 2*k) = 2*a(2^(m+1) - 1 - k), a(2^(m+1) + 2*k + 1) = 2*a(2^(m+1) - 1 - k) + 1. - Yosu Yurramendi, May 23 2020
a(n) = A020988(A102572(n)) XOR n. - Alan Michael Gómez Calderón, Mar 11 2025

A284459 Permutation of the positive integers: this permutation transforms the enumeration system of positive irreducible fractions A002487/A002487' (Calkin-Wilf) into the enumeration system A245327/A245328, and A162911/A162912 (Drib) into A020651/A020650 (Yu-Ting inverted).

Original entry on oeis.org

1, 2, 3, 6, 5, 4, 7, 10, 13, 12, 11, 14, 9, 8, 15, 26, 21, 20, 27, 22, 25, 24, 23, 18, 29, 28, 19, 30, 17, 16, 31, 42, 53, 52, 43, 54, 41, 40, 55, 50, 45, 44, 51, 46, 49, 48, 47, 58, 37, 36, 59, 38, 57, 56, 39, 34, 61, 60, 35, 62, 33, 32, 63
Offset: 1

Views

Author

Yosu Yurramendi, Mar 27 2017

Keywords

Comments

The inverse permutation is A284460.

Crossrefs

Programs

  • R
    maxrow <- 12 # by choice
    a <- 1
    b01 <- 1
    for(m in 0:maxrow){
      b01 <- c(b01, c(1-b01[2^m:(2^(m+1)-1)], b01[2^m:(2^(m+1)-1)]) )
      for(k in 0:(2^m-1)){
        a[2^(m+1) +       k] <- a[2^m + k] + 2^(m + b01[2^(m+1) +       k])
        a[2^(m+1) + 2^m + k] <- a[2^m + k] + 2^(m + b01[2^(m+1) + 2^m + k])
    }}
    a
    # Yosu Yurramendi, Mar 27 2017
    
  • R
    maxblock <- 7 # by choice
    a <- 1:3
    for(n in 4:2^maxblock){
    ones <- which(as.integer(intToBits(n)) == 1)
    nbit <- as.integer(intToBits(n))[1:tail(ones, n = 1)]
    anbit <- nbit
    for(i in 2:(length(anbit) - 1))
       anbit[i] <- 1 - bitwXor(anbit[i], anbit[i-1])
    a <- c(a, sum(anbit*2^(0:(length(anbit) - 1))))
    }
    a
    # Yosu Yurramendi, Apr 25 2021

Formula

a(n) = A258996(A231551(n)) = A231551(A092569(n)), n > 0 . - Yosu Yurramendi, Apr 10 2017

A284460 Permutation of the positive integers: this permutation transforms the enumeration system of positive irreducible fractions A245327/A245328 into the enumeration system A002487/A002487' (Calkin-Wilf), and A020651/A020650 (Yu-Ting inverted) into A162911/A162912(Drib).

Original entry on oeis.org

1, 2, 3, 6, 5, 4, 7, 14, 13, 8, 11, 10, 9, 12, 15, 30, 29, 24, 27, 18, 17, 20, 23, 22, 21, 16, 19, 26, 25, 28, 31, 62, 61, 56, 59, 50, 49, 52, 55, 38, 37, 32, 35, 42, 41, 44, 47, 46, 45, 40, 43, 34, 33, 36, 39, 54, 53, 48, 51, 58, 57, 60, 63
Offset: 1

Views

Author

Yosu Yurramendi, Mar 28 2017

Keywords

Comments

The inverse permutation is A284459.

Crossrefs

Programs

  • R
    maxrow <- 4 # by choice
    a <- 1
    b01 <- 1
    for(m in 0:maxrow){
      b01 <- c(b01,rep(1,2^(m+1))); b01[(2^(m+1)+2^m-2^(m-1)):(2^(m+1)+2^m+2^(m-1)-1)] <- 0
      for(k in 0:(2^m-1)){
        a[2^(m+1) +       k] <- a[2^m + k] + 2^(m + b01[2^(m+1) +       k])
        a[2^(m+1) + 2^m + k] <- a[2^m + k] + 2^(m + b01[2^(m+1) + 2^m + k])
    }}
    a
    # Yosu Yurramendi, Mar 28 2017

Formula

a(n) = A231550(A258996(n)) = A092569(A231550(n)), n > 0 . - Yosu Yurramendi, Apr 10 2017

A334998 Permutation of nonnegative integers that converts A162912 into A162911.

Original entry on oeis.org

1, 3, 2, 7, 4, 5, 6, 11, 8, 13, 10, 15, 12, 9, 14, 19, 16, 29, 18, 23, 20, 17, 22, 27, 24, 21, 26, 31, 28, 25, 30, 35, 32, 45, 34, 39, 36, 33, 38, 43, 40, 53, 42, 47, 44, 41, 46, 51, 48, 61, 50, 55, 52, 49, 54, 59, 56, 37, 58, 63, 60, 57, 62
Offset: 1

Views

Author

Yosu Yurramendi, May 19 2020

Keywords

Comments

For n > 0, A162912(a(n)) = A162911(n), as well as A162912(A054429(n)) = A162911(n). There is a self-inverse permutation, b, such that a(b(n)) = A054429(n), and a(n) = A054429(b(n)).

Crossrefs

Cf. A334999 (inverse), A054429, A162911, A162912.

Programs

A334999 Permutation of nonnegative integers that converts A162911 into A162912.

Original entry on oeis.org

1, 3, 2, 5, 6, 7, 4, 9, 14, 11, 8, 13, 10, 15, 12, 17, 22, 19, 16, 21, 26, 23, 20, 25, 30, 27, 24, 29, 18, 31, 28, 33, 38, 35, 32, 37, 58, 39, 36, 41, 46, 43, 40, 45, 34, 47, 44, 49, 54, 51, 48, 53, 42, 55, 52, 57, 62, 59, 56, 61, 50, 63, 60
Offset: 1

Views

Author

Yosu Yurramendi, May 19 2020

Keywords

Comments

For n > 0, A162911(a(n)) = A162912(n), as well as A162911(A054429(n)) = A162912(n). There is a self-inverse permutation, b, such that a(b(n)) = A054429(n), and a(n) = A054429(b(n)).

Crossrefs

Cf. A334998 (inverse), A054429, A162911, A162912.

Programs

A054429 Simple self-inverse permutation of natural numbers: List each block of 2^n numbers (from 2^n to 2^(n+1) - 1) in reverse order.

Original entry on oeis.org

1, 3, 2, 7, 6, 5, 4, 15, 14, 13, 12, 11, 10, 9, 8, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 127, 126, 125, 124, 123, 122, 121
Offset: 1

Views

Author

Keywords

Comments

a(n) gives the position of the inverse of the n-th term in the full Stern-Brocot tree: A007305(a(n)+2) = A047679(n) and A047679(a(n)) = A007305(n+2). - Reinhard Zumkeller, Dec 22 2008
From Gary W. Adamson, Jun 21 2012: (Start)
The mapping and conversion rules are as follows:
By rows, we have ...
1;
3, 2;
7, 6, 5, 4;
15, 14, 13, 12, 11, 10, 9, 8;
... onto which we are to map one-half of the Stern-Brocot infinite Farey Tree:
1/2
1/3, 2/3
1/4, 2/5, 3/5, 3/4
1/5, 2/7, 3/8, 3/7, 4/7, 5/8, 5/7, 4/5
...
The conversion rules are: Convert the decimal to binary, adding a duplicate of the rightmost binary term to its right. For example, 10 = 1010, which becomes 10100. Then, from the left, record the number of runs = [1,1,1,2], the continued fraction representation of 5/8. Check: 10 decimal corresponds to 5/8 as shown in the overlaid mapping. Take decimal 9 = 1001 which becomes 10011, with a continued fraction representation of [1,2,2] = 5/7. Check: 9 decimal corresponds to 5/7 in the Farey Tree map. (End)
From Indranil Ghosh, Jan 19 2017: (Start)
a(n) is the value generated when n is converted into its Elias gamma code, the 1's and 0's are interchanged and the resultant is converted back to its decimal value for all values of n > 1. For n = 1, A054429(n) = 1 but after converting 1 to Elias gamma code, interchanging the 1's and 0's and converting it back to decimal, the result produced is 0.
For example, let n = 10. The Elias gamma code for 10 is '1110010'. After interchanging the 1's and 0's it becomes "0001101" and 1101_2 = 13_10. So a(10) = 13. (End)
From Yosu Yurramendi, Mar 09 2017 (similar to Zumkeller's comment): (Start)
A002487(a(n)) = A002487(n+1), A002487(a(n)+1) = A002487(n), n > 0.
A162909(a(n)) = A162910(n), A162910(a(n)) = A162909(n), n > 0.
A162911(a(n)) = A162912(n), A162912(a(n)) = A162911(n), n > 0.
A071766(a(n)) = A245326(n), A245326(a(n)) = A071766(n), n > 0.
A229742(a(n)) = A245325(n), A245325(a(n)) = A229742(n), n > 0.
A020651(a(n)) = A245327(n), A245327(a(n)) = A020651(n), n > 0.
A020650(a(n)) = A245328(n), A245328(a(n)) = A020650(n), n > 0. (End)
From Yosu Yurramendi, Mar 29 2017: (Start)
A063946(a(n)) = a(A063946(n)) = A117120(n), n > 0.
A065190(a(n)) = a(A065190(n)) = A092569(n), n > 0.
A258746(a(n)) = a(A258746(n)) = A165199(n), n > 0.
A258996(a(n)) = a(A258996(n)), n > 0.
A117120(a(n)) = a(A117120(n)), n > 0.
A092569(a(n)) = a(A092569(n)), n > 0. (End)

Crossrefs

See also A054424, A054430.
{A000027, A054429, A059893, A059894} form a 4-group.
This is Guy Steele's sequence GS(6, 5) (see A135416).

Programs

  • Haskell
    a054429 n = a054429_list !! (n-1)
    a054429_list = f [1..] where
       f xs@(x:_) = reverse us ++ f vs where (us, vs) = splitAt x xs
    -- Reinhard Zumkeller, Jun 01 2015, Feb 21 2014
    
  • Maple
    A054429 := n -> 3*2^ilog2(n) - n - 1:
    seq(A054429(n), n = 1..70); # [Updated by Peter Luschny, Apr 24 2024]
  • Mathematica
    Flatten[Table[Range[2^(n+1)-1,2^n,-1],{n,0,6}]] (* Harvey P. Dale, Dec 17 2013 *)
  • PARI
    A054429(n)= 3<<#binary(n\2)-n-1 \\ M. F. Hasler, Aug 18 2014
    
  • Python
    from itertools import count, islice
    def A054429_gen(): # generator of terms
        return (m for n in count(0) for m in range((1<A054429_list = list(islice(A054429_gen(),30)) # Chai Wah Wu, Jul 27 2023
  • R
    maxblock <- 10 # by choice
    a <- NULL
    for(m in 0:maxblock) a <- c(a, rev(2^m:(2^(m+1)-1)))
    a
    # Yosu Yurramendi, Mar 10 2017
    

Formula

a(n) = ReflectBinTreePermutation(n).
a(n) = if n=1 then 1 else 2*a(floor(n/2)) + 1 - n mod 2. - Reinhard Zumkeller, Feb 18 2003
G.f.: 1/(1-x) * ((x-2x^2)/(1-x) + Sum_{k>=0} 3*2^k*x^2^k). - Ralf Stephan, Sep 15 2003
A000120(a(n)) = A000120(A059894(n)) = A023416(n) + 1. - Ralf Stephan, Oct 05 2003
A115310(n, 1) = a(n). - Reinhard Zumkeller, Jan 20 2006
a(1) = 1, a(2^(m+1) + k) = a(2^m+k) + 2^(m+1),
a(2^(m+1) + 2^m+k) = a(2^m+k) + 2^m, m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Apr 06 2017
a(n) = A117120(A063946(n)) = A063946(A117120(n)) = A092569(A065190(n)) = A065190(A092569(n)), n > 0. - Yosu Yurramendi, Apr 10 2017
a(n) = 3*A053644(n) - n - 1. - Alan Michael Gómez Calderón, Feb 28 2025

A162910 Denominators of Bird tree fractions.

Original entry on oeis.org

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

Views

Author

Ralf Hinze (ralf.hinze(AT)comlab.ox.ac.uk), Aug 05 2009

Keywords

Comments

The Bird tree is an infinite binary tree labeled with rational numbers. The root is labeled with 1. The tree enjoys the following fractal property: it can be transformed into its left subtree by first incrementing and then reciprocalizing the elements; for the right subtree interchange the order of the two steps: the elements are first reciprocalized and then incremented. Like the Stern-Brocot tree, the Bird tree enumerates all the positive rationals (A162909(n)/A162910(n)).
From Yosu Yurramendi, Jul 11 2014: (Start)
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, 3,1, 2,
5, 4,4, 5,2,1, 3, 3,
8, 7,5, 7,7,5, 7, 8, 3, 3,1,2, 5,4, 4, 5,
13,11,9,12,9,6,10,11,11,10,6,9,12,9,11,13,5,4,4,5,2,1,3,3,8,7,5,7,7,5,7,8,
then the sum of the m-th row is 3^m (m = 0,1,2,), each column k is a Fibonacci sequence.
If the rows are written in a right-aligned fashion:
1,
2,1,
3,3,1,2,
5,4,4,5,2,1,3,3,
8,7,5,7,7,5,7,8,3,3,1,2,5,4,4,5,
13,11,9,12,9,6,10,11,11,10,6,9,12,9,11,13,5,4,4,5,2,1,3,3,8,7,5,7,7,5,7,8,
then each column k also is a Fibonacci sequence.
The Fibonacci sequences of both triangles are equal except the first terms of second triangle.
If the sequence is considered by blocks of length 2^m, m = 0,1,2,..., the blocks of this sequence are the reverses of blocks of A162909 ( a(2^m+k) = A162909(2^(m+1)-1-k), m = 0,1,2,..., k = 0,1,2,...,2^m-1).
(End)

Examples

			The first four levels of the Bird tree: [1/1] [1/2, 2/1] [2/3, 1/3, 3/1, 3/2], [3/5, 3/4, 1/4, 2/5, 5/2, 4/1, 4/3, 5/3].
		

Crossrefs

This sequence is the composition of A162912 and A059893: a(n) = A162912(A059893(n)). This sequence is a permutation of A002487(n+2).

Programs

  • Haskell
    import Ratio; bird :: [Rational]; bird = branch (recip . succ) (succ . recip) 1; branch f g a = a : branch f g (f a) \/ branch f g (g a); (a : as) \/ bs = a : (bs \/ as); a162909 = map numerator bird; a162910 = map denominator bird
    
  • R
    blocklevel <- 6 # arbitrary
    a <- 1
    for(m in 1:blocklevel) for(k in 0:(2^(m-1)-1)){
    a[2^m+k]         = a[2^m-k-1] + a[2^(m-1)+k]
    a[2^m+2^(m-1)+k] = a[2^m-k-1]
    }
    a
    # Yosu Yurramendi, Jul 11 2014

Formula

a(2^m+k) = a(2^m-k-1) + a(2^(m-1)+k), a(2^m+2^(m-1)+k) = a(2^m-k-1), a(1) = 1, m=0,1,2,3,..., k=0,1,...,2^(m-1)-1. - Yosu Yurramendi, Jul 11 2014
If k is odd a(A080675(n)*2^m+k) = A268087(2^m+k), if k is even a(A136412(2^m+k+1)*2^m+k) = A268087(2^m+k), m >= 0, 0 <= k < 2^m, n > 0. a(A081254(n)) = 1, n > 0. - Yosu Yurramendi, Feb 21 2017
a(n) = A002487(1+A258996(A059893(n))) = A002487(1+A059893(A258746(n))), n > 0. - Yosu Yurramendi, Jul 14 2021

A162911 Numerators of drib tree fractions, where drib is the bit-reversal permutation tree of the Bird tree.

Original entry on oeis.org

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

Views

Author

Ralf Hinze (ralf.hinze(AT)comlab.ox.ac.uk), Aug 05 2009

Keywords

Comments

The drib tree is an infinite binary tree labeled with rational numbers. It is generated by the following iterative process: start with the rational 1; for the left subtree increment and then reciprocalize the current rational; for the right subtree interchange the order of the two steps: the rational is first reciprocalized and then incremented. Like the Stern-Brocot and the Bird tree, the drib tree enumerates all the positive rationals (A162911(n)/A162912(n)).
From Yosu Yurramendi, Jul 11 2014: (Start)
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,1, 4, 3, 4,2, 5,
5, 8,2, 7, 4, 5,3, 7,4, 7,1, 5, 5, 7,3, 8,
...
then the sum of the m-th row is 3^m (m = 0,1,2,), each column k is a Fibonacci-type sequence.
If the rows are written in a right-aligned fashion:
1
1, 2
2, 3,1, 3
3, 5,1, 4, 3, 4,2, 5
5, 8,2, 7,4, 5,3, 7, 4, 7,1, 5, 5, 7,3, 8
...
then each column k also is a Fibonacci-type sequence.
If the sequence is considered by blocks of length 2^m, m = 0,1,2,..., the blocks of this sequence are the reverses of blocks of A162912 (a(2^m+k) = A162912(2^(m+1)-1-k), m = 0,1,2,..., k = 0..2^m-1).
(End)
From Yosu Yurramendi, Jan 12 2017: (Start)
a(2^(m+2m' ) + A020988(m')) = A000045(m+1), m>=0, m'>=0
a(2^(m+2m'+1) + A020989(m')) = A000045(m+3), m>=0, m'>=0
a(2^(m+2m' ) - 1 - A002450(m')) = A000045(m+1), m>=0, m'>=0
a(2^(m+2m'+1) - 1 - A072197(m'-1)) = A000045(m+3), m>=0, m'>0
a(2^(m+1) -1) = A000045(m+2), m>=0. (End)

Examples

			The first four levels of the drib tree:
  [1/1],
  [1/2, 2/1],
  [2/3, 3/1, 1/3, 3/2],
  [3/5, 5/2, 1/4, 4/3, 3/4, 4/1, 2/5, 5/3].
		

Crossrefs

This sequence is the composition of A162909 and A059893: a(n) = A162909(A059893(n)). This sequence is a permutation of A002487(n+1).

Programs

  • Haskell
    import Ratio; drib :: [Rational]; drib = 1 : map (recip . succ) drib \/ map (succ . recip) drib; (a : as) \/ bs = a : (bs \/ as); a162911 = map numerator drib; a162912 = map denominator drib
    
  • PARI
    a(n) = my(x = 0, y = 1); forstep(i = logint(n, 2), 0, -1, [x, y] = if(bittest(n, i), [y, x + y], [x + y, x])); y \\ Mikhail Kurkov, Oct 12 2023
  • R
    blocklevel <- 6 # arbitrary
    a <- 1
    for(m in 0:blocklevel) for(k in 0:(2^m-1)){
      a[2^(m+1)+2*k  ] <- a[2^(m+1)-1-k]
      a[2^(m+1)+2*k+1] <- a[2^(m+1)-1-k] + a[2^m+k]
    }
    a
    # Yosu Yurramendi, Jul 11 2014
    

Formula

a(n) where a(1) = 1; a(2n) = b(n); a(2n+1) = a(n) + b(n); and b(1) = 1; b(2n) = a(n) + b(n); b(2n+1) = a(n).
a(2^(m+1)+2*k) = a(2^(m+1)-k-1), a(2^(m+1)+2*k+1) = a(2^(m+1)-k-1) + a(2^m+k), a(1) = 1, m>=0, k=0..2^m-1. - Yosu Yurramendi, Jul 11 2014
a(2^(m+1) + 2*k) = A162912(2^m + k), m >= 0, 0 <= k < 2^m.
a(2^(m+1) + 2*k + 1) = a(2^m + k) + A162912(2^m + k), m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Mar 30 2016
a(n*2^m + A176965(m)) = A268087(n), n > 0, m > 0. - Yosu Yurramendi, Feb 20 2017
a(n) = A002487(A258996(n)), n > 0. - Yosu Yurramendi, Jun 23 2021

A231551 Position of n in A231550.

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 6, 5, 8, 15, 14, 9, 12, 11, 10, 13, 16, 31, 30, 17, 28, 19, 18, 29, 24, 23, 22, 25, 20, 27, 26, 21, 32, 63, 62, 33, 60, 35, 34, 61, 56, 39, 38, 57, 36, 59, 58, 37, 48, 47, 46, 49, 44, 51, 50, 45, 40, 55, 54, 41, 52, 43, 42, 53, 64, 127, 126, 65
Offset: 0

Views

Author

Alex Ratushnyak, Nov 10 2013

Keywords

Comments

This permutation transforms the enumeration system of positive irreducible fractions A002487/A002487' (Calkin-Wilf) into the enumeration system A020651/A020650, and A162911/A162912 (Drib) the enumeration system into A245327/A245326. - Yosu Yurramendi, Jun 16 2015

Crossrefs

Programs

  • Mathematica
    Join[{0, 1}, Table[d = Reverse@IntegerDigits[n, 2]; FromDigits[Reverse@Append[FoldList[BitXor, d[[1]], Most@Rest@d], d[[-1]]], 2], {n, 2, 67}]] (* Ivan Neretin, Dec 28 2016 *)
  • Python
    for n in range(99):
      bits = [0]*64
      orig = [0]*64
      l = int.bit_length(int(n))
      t = n
      for i in range(l):
        bits[i] = orig[i] = t&1
        t>>=1
      #for i in range(1, l-1):  bits[i] ^= orig[i-1]   # A231550
      for i in range(1, l-1):  bits[i] ^= bits[i-1]   # A231551
      #for i in range(l-1):  bits[i] ^= orig[i+1]      # A003188
      #for i in range(1, l):  bits[l-1-i] ^= bits[l-i]  # A006068
      t = 0
      for i in range(l):  t += bits[i]<
    				
  • R
    maxrow <- 8 # by choice
    b01 <- 0 # b01 is going to be A010059
    a <- 1
    for(m in 0:maxrow) for(k in 0:(2^m-1)){
       b01[2^(m+1)+    k] <-     b01[2^m+k]
         a[2^(m+1)+    k] <-       a[2^m+k]  + 2^(m+b01[2^(m+1)+    k])
       b01[2^(m+1)+2^m+k] <- 1 - b01[2^m+k]
         a[2^(m+1)+2^m+k] <-       a[2^m+k]  + 2^(m+b01[2^(m+1)+2^m+k])
    }
    (a <- c(0,a))
    # Yosu Yurramendi, Apr 10 2017
    
  • R
    maxblock <- 8 # by choice
    a <- 1:3
    for(n in 4:2^maxblock){
    ones <- which(as.integer(intToBits(n)) == 1)
    nbit <- as.integer(intToBits(n))[1:tail(ones, n = 1)]
    anbit <- nbit
    for(i in 2:(length(anbit) - 1))
       anbit[i] <- bitwXor(anbit[i], anbit[i-1])  # ?bitwXor
    a <- c(a, sum(anbit*2^(0:(length(anbit) - 1))))
    }
    (a <- c(0,a))
    # Yosu Yurramendi, Apr 25 2021

Formula

A231550(a(n)) = a(A231550(n)) = n.
a(n) = A258996(A284460(n)) = A284459(A092569(n)), n > 0. - Yosu Yurramendi, Apr 10 2017
a(n) = A054429(A153154(n)), n > 0. - Yosu Yurramendi, Oct 04 2021

A268087 a(n) = A162909(n) + A162910(n).

Original entry on oeis.org

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

Author

Yosu Yurramendi, Jan 26 2016

Keywords

Comments

If the terms (n>0) are written as an array (in a left-aligned fashion) with rows of length 2^m, m >= 0:
2,
3, 3,
5, 4, 4, 5,
8, 7, 5, 7, 7, 5, 7, 8,
13,11, 9,12, 9, 6,10,11,11,10,6, 9,12, 9,11,13,
21,18,14,19,16,11,17,19,14,13,7,11,17,13,15,18,18,15,13,17,11,7,13,14,19,17,11,16, ...
a(n) is palindromic in each level m >= 0 (ranks between 2^m and 2^(m+1)-1), because in each level m >= 0 A162910 is the reverse of A162909:
a(2^m + k) = a(2^(m+1) - 1 - k), m >= 0, 0 <= k < 2^m.
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).
a(2^m + k) = A162909(2^(m+2) + k), a(2^m + k) = A162909(2^(m+1)+ 2^m + k), a(2^m + k) = A162910(2^(m+1) + k), m >= 0, 0 <= k < 2^m (empirical observations).
a(n) = A162911(n) + A162912(n), where A162911(n)/A162912(n) is the bit reversal permutation of A162909(n)/A162910(n) in each level m >= 0 (empirical observations).
a(n) = A162911(2n+1), a(n) = A162912(2n) for n > 0 (empirical observations). 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. A162909(n)/A162910(n) is also an enumeration system of all positive rationals (Bird system), 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), and A086592 (A020650+A020651).

Examples

			m = 3, k = 6: a(38) = 17, a(22) = 10, a(14) = 7.
		

Programs

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

Formula

a(2^(m+2)+k) = a(2^(m+1)+k) + a(2^m+k) with m = 0, 1, 2, ... and 0 <= k < 2^m (empirical observation).
a(A059893(n)) = a(n) for n > 0. - Yosu Yurramendi, May 30 2017
From Yosu Yurramendi, May 14 2019: (Start)
Take the smallest m > 0 such that 0 <= k < 2^(m-1), and choose any M >= m,
a((1/3)*( A016921(2^(m-1)+k)*4^(M-m)-1)) = 2*a(2^(m-1)+k)*(M-m) + a(2^m+2*k ).
a((1/3)*(2*A016921(2^(m-1)+k)*4^(M-m)-2)) = 2*a(2^(m-1)+k)*(M-m) + a(2^m+2*k ) + a(2^(m-1)+k).
a((1/3)*( A016969(2^(m-1)+k)*4^(M-m)-2)) = 2*a(2^(m-1)+k)*(M-m) + a(2^m+2*k+1).
a((1/3)*(2*A016969(2^(m-1)+k)*4^(M-m)-1)) = 2*a(2^(m-1)+k)*(M-m) + a(2^m+2*k+1) + a(2^(m-1)+k). (End)
a(n) = A007306(A258996(n)), n > 0. - Yosu Yurramendi, Jun 23 2021
Showing 1-10 of 13 results. Next