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 22 results. Next

A132750 A132749 * [1, 2, 3, ...] = A007318 * A065190.

Original entry on oeis.org

1, 4, 9, 21, 49, 113, 257, 577, 1281, 2817, 6145, 13313, 28673, 61441, 131073, 278529, 589825, 1245185, 2621441, 5505025, 11534337, 24117249, 50331649, 104857601, 218103809, 452984833, 939524097, 1946157057, 4026531841
Offset: 0

Views

Author

Gary W. Adamson, Aug 28 2007

Keywords

Comments

Equals double binomial transform of [1, 2, -3, 7, -15, 31, -63, 127, -255, ...]. - Gary W. Adamson, Jul 23 2008
For n >= 1, also the number of cliques in the n-hypercube graph Q_n. - Eric W. Weisstein, Mar 31 2017

Examples

			a(3) = 21 = (1, 3, 3, 1) dot (1, 3, 2, 5) = (1 + 9 + 6 + 5) = 21; where A065190 = (1, 3, 2, 5, 4, 7, 6, 9, ...).
		

Crossrefs

Programs

  • GAP
    Concatenation([1], List([1..30], n-> n*2^(n-1) + 2^n + 1 )); # G. C. Greubel, Nov 20 2019
  • Magma
    [n*2^(n-1) + 2^n + 1 - 0^n : n in [0..30]]; // Wesley Ivan Hurt, Sep 26 2014
    
  • Maple
    A132750:=n->n*2^(n-1)+2^n+1-0^n: seq(A132750(n), n=0..30); # Wesley Ivan Hurt, Sep 26 2014
  • Mathematica
    Join[{1}, Table[n*2^(n-1) +2^n +1, {n, 30}]] (* Wesley Ivan Hurt, Sep 26 2014 *)
    Join[{1}, LinearRecurrence[{5,-8,4}, {4,9,21}, 30]] (* Vincenzo Librandi, Apr 01 2017 *)
  • PARI
    vector(31, n, if(n==1, 1, (n-1)*2^(n-2) + 2^(n-1) + 1)) \\ G. C. Greubel, Nov 20 2019
    
  • Sage
    [1]+[n*2^(n-1) + 2^n + 1 for n in (1..30)] # G. C. Greubel, Nov 20 2019
    

Formula

A132749 as an infinite lower triangular matrix * vector [1, 2, 3, ...]. Binomial transform of A065190 (with an incorrect offset)
Row sums of triangle A135224. - Gary W. Adamson, Nov 23 2007
G.f.: (1-x-3*x^2+4*x^3)/((1-x)*(1-2*x)^2). - Colin Barker, Aug 09 2012
a(n) = n*2^(n-1) + 2^n + 1 - 0^n. - Tim Smith, Sep 25 2014
a(n) = 5*a(n-1) - 8*a(n-2) + 4*a(n-3). - Wesley Ivan Hurt, Sep 26 2014
E.g.f.: -1 + exp(x) + (1+x)*exp(2*x). - G. C. Greubel, Nov 20 2019

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

A014681 Fix 0; exchange even and odd numbers.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

A self-inverse permutation of the nonnegative numbers.
If we ignore the first term 0, then this can be obtained as: a(n) is the smallest number different from n, not occurring earlier and coprime to n. - Amarnath Murthy, Apr 16 2003 [Corrected by Alois P. Heinz, May 06 2015]
a(0)=0, a(1)=2, then repeatedly subtract 1 and then add 3. - Jon Perry, Aug 12 2014
The biggest term of the pair [a(n), a(n+1)] is always even. This is the lexicographically first sequence with this property starting with a(1) = 0 and always extented with the smallest integer not yet present. - Eric Angelini, Feb 20 2017

Crossrefs

Composing this permutation with A065190 gives A065164.
Equals 1 + A004442.
Cf. A103889.

Programs

  • Mathematica
    Table[n - (-1)^n, {n, 1, 60}]
    Join[{0},LinearRecurrence[{1, 1, -1},{2, 1, 4},69]] (* Ray Chandler, Sep 03 2015 *)
  • PARI
    a(n)=n - (-1)^n \\ Charles R Greathouse IV, May 06 2015

Formula

G.f.: x*(2-x+x^2)/((1-x)*(1-x^2)). - N. J. A. Sloane
a(n) = n - (-1)^n = a(n-1) + a(n-2) - a(n-3) = a(n-2) + 2. - Henry Bottomley, Mar 29 2000
a(0) = 0; a(2m+1) = 2m+2; for m > 0 a(2m) = 2m - 1. - George E. Antoniou, Dec 04 2001
a(n) = n - (-1)^n + 0^n for n >= 0. - Bruno Berselli, Nov 16 2010
E.g.f.: 1 + (x - 1)*cosh(x) + (1 + x)*sinh(x). - Stefano Spezia, Sep 02 2022

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

A063946 Write n in binary and complement second bit (from the left), with a(0)=0 and a(1)=1.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Sep 03 2001

Keywords

Comments

From Yosu Yurramendi, Mar 21 2017: (Start)
This sequence is a self-inverse permutation of the integers. Except for fixed points 0, 1, it consists completely of 2-cycles: (2^(m+1)+k, 2^(m+1)+2^m+k), m >= 0, 0 <= k < 2^m.
A071766(a(n)) = A229742(n), A229742(a(n)) = A071766(n), n > 0.
A245325(a(n)) = A245326(n), A245326(a(n)) = A245325(n), n > 0.
A065190(a(n)) = a(A065190(n)), n > 0.
A054429(a(n)) = a(A054429(n)) = A117120(n), n > 0.
A258746(a(n)) = a(A258746(n)), n > 0.
A258996(a(n)) = a(A258996(n)), n > 0. (End)
A324337(a(n)) = A324338(n), A324338(a(n)) = A324337(n), n > 0. - Yosu Yurramendi, Nov 04 2019

Examples

			a(11)=15 since 11 is written in binary as 1011, which changes to 1111, i.e., 15; a(12)=8 since 12 is written as 1100 which changes to 1000, i.e., 8.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember;
      if n<2 then n
    elif n<4 then 5-n
    elif `mod`(n,2)=0 then 2*a(n/2)
    else 2*a((n-1)/2) + 1
      fi; end proc;
    seq(a(n), n = 0..80); # G. C. Greubel, Dec 08 2019
  • Mathematica
    bc[n_]:=Module[{idn2=IntegerDigits[n,2]},If[idn2[[2]]==1,idn2[[2]]=0, idn2[[2]]=1];FromDigits[idn2,2]]; Join[{0,1},Array[bc,80,2]] (* Harvey P. Dale, May 31 2012 *)
    a[n_]:= a[n]= If[n<2, n, If[n<4, 5-n, If[EvenQ[n], 2*a[n/2], 2*a[(n-1)/2] +1]]];  Table[a[n], {n,0,80}] (* G. C. Greubel, Dec 08 2019 *)
  • PARI
    a(n)=if(n<2,n>0,3/2*2^floor(log(n)/log(2))-2^floor(log(4/3*n)/log(2))+n) /* Ralf Stephan */
    
  • PARI
    a(n) = if(n<2,n, bitxor(n, 1<<(logint(n,2)-1))); \\ Kevin Ryde, Apr 09 2020
    
  • Python
    import math
    def a(n): return n if n<2 else 3/2*2**int(math.floor(math.log(n)/math.log(2))) - 2**int(math.floor(math.log(4/3*n)/math.log(2))) + n # Indranil Ghosh, Mar 22 2017
    
  • R
    maxrow <- 8 # by choice
    b01 <- 1
    for(m in 0:(maxrow-1)){
      b01 <- c(b01,rep(0,2^(m+1))); b01[2^(m+1):(2^(m+1)+2^m-1)] <- 1
    }
    a <- c(1,3,2)
    for(m in 0:(maxrow-2))
      for(k in 0:(2^m-1)){
        a[2^(m+2) +                 k] <- a[2^(m+1) + 2^m + k] + 2^((m+1) + b01[2^(m+2) +                 k])
        a[2^(m+2) +         + 2^m + k] <- a[2^(m+1) +       k] + 2^((m+1) + b01[2^(m+2) +         + 2^m + k])
        a[2^(m+2) + 2^(m+1) +       k] <- a[2^(m+1) + 2^m + k] + 2^((m+1) + b01[2^(m+2) + 2^(m+1) +       k])
        a[2^(m+2) + 2^(m+1) + 2^m + k] <- a[2^(m+1) +       k] + 2^((m+1) + b01[2^(m+2) + 2^(m+1) + 2^m + k])
    }
    (a <- c(0,a))  # Yosu Yurramendi, Mar 30 2017
    
  • R
    a <- c(1,3,2)
    maxn <- 63 # by choice
    for(n in 2:maxn){ a[2*n  ] <- 2*a[n]
                      a[2*n+1] <- 2*a[n] + 1  }
    (a <- c(0,a))  # Yosu Yurramendi, Nov 12 2019
    
  • Sage
    @CachedFunction
    def a(n):
        if (n<2): return n
        elif (n<4): return 5-n
        elif (mod(n,2)==0): return 2*a(n/2)
        else: return 2*a((n-1)/2) + 1
    [a(n) for n in (0..80)] # G. C. Greubel, Dec 08 2019

Formula

If 2*2^k <= n < 3*2^k then a(n) = n + 2^k; if 3*2^k <= n < 4*2^k then a(n) = n - 2^k.
a(0)=0, a(1)=1, a(2)=3, a(3) = 2, a(2n) = 2*a(n), a(2n+1) = 2*a(n) + 1. - Ralf Stephan, Aug 23 2003

A258746 Permutation of the positive integers: this permutation transforms the enumeration system of positive irreducible fractions A007305/A047679 (Stern-Brocot) into the enumeration system A162909/A162910 (Bird), and vice versa.

Original entry on oeis.org

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

Views

Author

Yosu Yurramendi, Jun 09 2015

Keywords

Comments

As A117120 the permutation is self-inverse. Except for fixed points 1, 2, 3 it consists completely of 2-cycles: (4,5), (6,7), (8,10), (9,11), (12,14), (13,15), (16,21), (17,20), ..., (24,29), ..., (32,42), ... .

Crossrefs

Cf. A117120.

Programs

  • R
    a <- 1:3
    maxn <- 50 # by choice
    #
    for(n in 2:maxn){
      m <- floor(log2(n))
      if(m%%2 == 0) {
        a[2*n  ] <- 2*a[n]
        a[2*n+1] <- 2*a[n]+1 }
      else {
        a[2*n  ] <- 2*a[n]+1
        a[2*n+1] <- 2*a[n]   }
    }
    #
    a
    # Yosu Yurramendi, Jun 09 2015
    
  • 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
    ifelse(floor(log2(n)) %% 2 == 0,
       anbit[seq(1, length(anbit)-1, 2)] <- 1 - anbit[seq(1, length(anbit)-1, 2)],
       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, May 29 2021

Formula

a(1) = 1, a(2) = 2, a(3) = 3. For n >= 2, m = floor(log_2(n)). If m even, then a(2*n) = 2*a(n) and a(2*n+1) = 2*a(n)+1. If m odd, then a(2*n) = 2*a(n)+1 and a(2*n+1) = 2*a(n).
From Yosu Yurramendi, Mar 23 2017: (Start)
A258996(a(n)) = a(A258996(n)) for n > 0;
A117120(a(n)) = a(A117120(n)) for n > 0;
A092569(a(n)) = a(A092569(n)) for n > 0;
A063946(a(n)) = a(A063946(n)) for n > 0;
A054429(a(n)) = a(A054429(n)) = A165199(n) for n > 0;
A065190(a(n)) = a(A065190(n)) for n > 0. (End)
a(n) = A054429(A165199(n)). - Alan Michael Gómez Calderón, Mar 08 2025

A092569 Permutation of integers a(a(n)) = n. In binary representation of n, transformation of inner bits, 1 <-> 0, gives binary representation of a(n).

Original entry on oeis.org

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

Views

Author

Zak Seidov, Feb 28 2004

Keywords

Comments

Primes which stay primes under transformation "opposite inner bits", A092570.
This permutation transforms the enumeration system of positive irreducible fractions A020651/A020650 into the enumeration system A245327/A245326, and vice versa. - Yosu Yurramendi, Jun 16 2015
A117120(a(n)) = a(A117120(n)), n > 0.
A258996(a(n)) = a(A258996(n)), n > 0.
A258746(a(n)) = a(A258746(n)), n > 0.
A054429(a(n)) = a(A054429(n)), n > 0.
a(n) = A054429(A065190(n)) = A065190(A054429(n)), n > 0. - Yosu Yurramendi, Mar 23 2017

Examples

			a(9)=15 because 9_10 = 1001_2, transformation of inner bits gives 1001_2 -> 1111_2 = 15_10.
		

Crossrefs

Cf. A092570.

Programs

  • Mathematica
    bb={0, 1, 2, 3};Do[id=IntegerDigits[n, 2];Do[id[[i]]=1-id[[i]], {i, 2, Length[id]-1}];bb=Append[bb, FromDigits[id, 2]], {n, 4, 1000}];fla=Flatten[bb]
    (* Second program: *)
    Table[If[n < 2, n, Function[b, FromDigits[#, 2] &@ Join[{First@ b}, Most[Rest@ b] /. { 0 -> 1, 1 -> 0}, {Last@ b}]]@ IntegerDigits[n, 2]], {n, 0, 70}] (* Michael De Vlieger, Apr 03 2017 *)
  • PARI
    T(n)={pow2=2;v=binary(n);L=#v-1;forstep(k=L,2,-1,if(v[k],n-=pow2,n+=pow2);pow2*=2);return(n)};
    for(n=0,70,print1(T(n),", ")) \\ Washington Bomfim, Jan 18 2011
    
  • R
    maxrow <- 8 # by choice
    a <- 1:3 # If it were c(1, 3, 2), it would be A054429
    for(m in 1:maxrow) for(k in 0:(2^m-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
    }
    a
    # Yosu Yurramendi, Apr 10 2017

Formula

a(0) = 0, a(1) = 1, a(2) = 2, a(3) = 3, 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 >= 1, 0 <= k < 2^m. - Yosu Yurramendi, Apr 02 2017

A065164 Permutation t->t+1 of Z, folded to N.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Oct 19 2001

Keywords

Comments

Corresponds to simple periodic asynchronic site swap pattern ...111111... (tossing one ball from hand to hand forever).
This permutation consists of a single infinite cycle.
This is, starting at a(2) = 4, the same as the "increasing oscillating sequence" shown in Proposition 3.1, p.7 and plotted in the right of figure 1, of Vatter. The same paper, p.4, cites Comtet and uses without giving the A-number of A003319. Abstract: We prove that there are permutation classes (hereditary properties of permutations) of every growth rate (Stanley-Wilf limit) at least lambda = approx 2.48187, the unique real root of x^5-2x^4-2x^2-2x-1, thereby establishing a conjecture of Albert and Linton. - Jonathan Vos Post, Jul 18 2008

References

  • Miklos Bona, editor, Handbook of Enumerative Combinatorics, CRC Press, 2015, page 819.

Crossrefs

Row 1 of A065167. Obtained by composing permutations A014681 and A065190. Inverse permutation: A065168.

Programs

  • Maple
    ss1 := [seq(PerSS(n,1), n=1..120)]; PerSS := (n,c) -> Z2N(N2Z(n)+c);
    N2Z := n -> ((-1)^n)*floor(n/2); Z2N := z -> 2*abs(z)+`if`((z < 1),1,0);
  • Mathematica
    Join[{2}, LinearRecurrence[{1, 1, -1}, {4, 1, 6}, 100]] (* Amiram Eldar, Aug 08 2023 *)

Formula

Let f: Z -> N be given by f(z) = 2z if z>0 else 2|z|+1, with inverse g(z) = z/2 if z even else (1-z)/2. Then a(n) = f(g(n)+1).
a(n) = n + 2*(-1^n) for n > 1. - Frank Ellermann, Feb 12 2002
a(n) = 2*n-a(n-1)-1, n>2. - Vincenzo Librandi, Dec 07 2010, corrected by R. J. Mathar, Dec 07 2010
From Colin Barker, Feb 18 2013: (Start)
a(n) = a(n-1) + a(n-2) - a(n-3) for n>4.
G.f.: x*(3*x^3-5*x^2+2*x+2) / ((x-1)^2*(x+1)). (End)
Sum_{n>=1} (-1)^(n+1)/a(n) = log(2) + 1. - Amiram Eldar, Aug 08 2023

A153154 Permutation of natural numbers: A059893-conjugate of A006068.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Dec 20 2008

Keywords

Comments

A002487(1+a(n)) = A020651(n) and A002487(a(n)) = A020650(n). So, it generates the enumeration system of positive rationals based on Stern's sequence A002487. - Yosu Yurramendi, Feb 26 2020

Crossrefs

Inverse: A153153. a(n) = A059893(A006068(A059893(n))).

Programs

  • R
    maxn <- 63 # by choice
    a <- c(1,3,2)
    #
    for(n in 2:maxn){
      a[2*n] <- 2*a[n] + 1
      if(n%%2==0) a[2*n+1] <- 2*a[n+1]
      else        a[2*n+1] <- 2*a[n-1]
    }
    (a <- c(0,a))
    # Yosu Yurramendi, Feb 26 2020
    
  • R
    # Given n, compute a(n) by taking into account the binary representation of n
    maxblock <- 8 # by choice
    a <- c(1, 3, 2)
    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
      anbit[0:(length(anbit) - 1)] <- 1 - anbit[0:(length(anbit) - 1)]
      a <- c(a, sum(anbit*2^(0:(length(anbit) - 1))))
    }
    (a <- c(0, a))
    # Yosu Yurramendi, Oct 04 2021

Formula

From Yosu Yurramendi, Feb 26 2020: (Start)
a(1) = 1, for all n > 0 a(2*n) = 2*a(n) + 1, a(2*n+1) = 2*a(A065190(n)).
a(1) = 1, a(2) = 3, a(3) = 2, for all n > 1 a(2*n) = 2*a(n) + 1, and if n even a(2*n+1) = 2*a(n+1), else a(2*n+1) = 2*a(n-1).
a(n) = A054429(A231551(n)) = A231551(A065190(n)) = A284459(A054429(n)) =
A332769(A284459(n)) = A258996(A154437(n)). (End)

A154437 Permutation of nonnegative integers: A059893-conjugate of A154435.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jan 17 2009

Keywords

Comments

This permutation is induced by the same Lamplighter group generating wreath recursion (binary transducer) as A154435, starting from the active (swapping) state a, but in contrast to it, this one rewrites the bits from the least significant end up to the second most significant bit.

Crossrefs

Inverse: A154438. a(n) = A059893(A154435(A059893(n))) = A054429(A153154(A054429(n))).

Programs

  • R
    maxn <- 63 # by choice
    a <- c(1,3,2)
    for(n in 2:maxn){
    a[2*n+1] <- 2*a[n]
    if(n%%2 == 0) a[2*n] <- 2*a[n+1] + 1
    else          a[2*n] <- 2*a[n-1] + 1
    }
    (a <- c(0,a))
    # Yosu Yurramendi, Feb 23 2020

Formula

From Yosu Yurramendi, Feb 23 2020: (Start)
a(n) = A054429(A284459(n)) = A258996(A153154(n)) = A284459(A065190(n)).
a(1) = 1; for n > 0, a(2*n) = 2*a(A065190(n)) + 1, a(2*n+1) = 2*a(n). (End)
Showing 1-10 of 22 results. Next