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

A180201 Inverse permutation to A180200.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Aug 15 2010

Keywords

Comments

A180199(n) = a(a(n));
a(A180198(n)) = A180198(a(n)) = A180200(n);
a(A075427(n)) = A075427(n).
This permutation transforms the enumeration system of positive irreducible fractions A245325/A245326 into the enumeration system A007305/A047679 (Stern-Brocot), and enumeration system A071766/A229742 (HCS) into A162909/A162910 (Bird). - Yosu Yurramendi, Jun 09 2015

Programs

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

Formula

a(n) = A233280(A258746(n)) = A117120(A233280(n)), n > 0. - Yosu Yurramendi, Apr 10 2017 [Corrected by Yosu Yurramendi, Mar 14 2025]
a(0) = 0, a(1) = 1, for n > 0 a(2*n) = 2*a(n) + [n even], a(2*n + 1) = 2*a(n) + [n odd]. - Yosu Yurramendi, May 23 2020
From Alan Michael Gómez Calderón, Mar 04 2025: (Start)
a(n) = A054429(n) XOR floor(n/2) for n > 0.
a(n) = A054429(A003188(n)) for n > 0. (End)
a(n) = A154436(A054429(n)), n > 0. - Yosu Yurramendi, Mar 11 2025

A180198 a(n) = A180200(A180200(n)).

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Aug 15 2010

Keywords

Comments

Permutation of the natural numbers with inverse A180199;
a(A180201(n)) = A180201(a(n)) = A180200(n);
a(A075427(n)) = A075427(n).

Crossrefs

A006068 a(n) is Gray-coded into n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Equivalently, if binary expansion of n has m bits (say), compute derivative of n (A038554), getting sequence n' of length m-1; sort on n'.
Inverse of sequence A003188 considered as a permutation of the nonnegative integers, i.e., a(A003188(n)) = n = A003188(a(n)). - Howard A. Landman, Sep 25 2001
The sequence exhibits glide reflections that grow fractally. These show up well on the scatterplot, also audibly using the "listen" link. - Peter Munn, Aug 18 2019
Each bit at bit-index k (counted from the right hand end, with the least significant bit having bit-index 0) in the binary representation of a(n) is the parity of the number of 1's among the bits of the binary representation of n that have a bit-index of k or higher. - Frederik P.J. Vandecasteele, May 26 2025

Examples

			The first few values of n' are -,-,1,0,10,11,01,00,100,101,111,110,010,011,001,000,... (for n=0..15) and to put these in lexicographic order we must take n in the order 0,1,3,2,7,6,4,5,15,14,12,13,8,9,11,10,...
		

References

  • M. Gardner, Mathematical Games, Sci. Amer. Vol. 227 (No. 2, Feb. 1972), p. 107.
  • M. Gardner, Knotted Doughnuts and Other Mathematical Entertainments. Freeman, NY, 1986, p. 15.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A054429, A180200. - Reinhard Zumkeller, Aug 15 2010
Cf. A000079, A055975 (first differences), A209281 (binary weight).
A003987, A010060 are used to express relationship between terms of this sequence.

Programs

  • Haskell
    a006068 n = foldl xor 0 $
                      map (div n) $ takeWhile (<= n) a000079_list :: Integer
    -- Reinhard Zumkeller, Apr 28 2012
    
  • Maple
    a:= proc(n) option remember; `if`(n<2, n,
          Bits[Xor](n, a(iquo(n, 2))))
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Apr 17 2018
  • Mathematica
    a[n_] := BitXor @@ Table[Floor[n/2^m], {m, 0, Floor[Log[2, n]]}]; a[0]=0; Table[a[n], {n, 0, 69}] (* Jean-François Alcover, Jul 19 2012, after Paul D. Hanna *)
    Table[Fold[BitXor, n, Quotient[n, 2^Range[BitLength[n] - 1]]], {n, 0, 70}] (* Jan Mangaldan, Mar 20 2013 *)
  • PARI
    {a(n)=local(B=n);for(k=1,floor(log(n+1)/log(2)),B=bitxor(B,n\2^k));B} /* Paul D. Hanna, Jan 18 2012 */
    
  • PARI
    /* the following routine needs only O(log_2(n)) operations */
    a(n)= {
        my( s=1, ns );
        while ( 1,
            ns = n >> s;
            if ( 0==ns, break() );
            n = bitxor(n, ns);
            s <<= 1;
        );
        return ( n );
    } /* Joerg Arndt, Jul 19 2012 */
    
  • Python
    def a(n):
        s=1
        while True:
            ns=n>>s
            if ns==0: break
            n=n^ns
            s<<=1
        return n
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 07 2017, after PARI code by Joerg Arndt
    
  • R
    nmax <- 63 # by choice
    a <- vector()
    for(n in 1:nmax){
      ones <- which(as.integer(intToBits(n)) == 1)
      nbit <- as.integer(intToBits(n))[1:tail(ones, n = 1)]
      level <- 0; anbit <- nbit; anbit.s <- nbit
      while(sum(anbit.s) > 0){
        s <- 2^level; if(s > length(anbit.s)) break
        anbit.s <- c(anbit[-(1:s)], rep(0,s))
        anbit <- bitwXor(anbit, anbit.s)
        level <- level + 1
      }
      a <- c(a, sum(anbit*2^(0:(length(anbit) - 1))))
    }
    (a <- c(0,a))
    # Yosu Yurramendi, Oct 12 2021, after PARI code by Joerg Arndt

Formula

a(n) = 2*a(ceiling((n+1)/2)) + A010060(n-1). If 3*2^(k-1) < n <= 2^(k+1), a(n) = 2^(k+1) - 1 - a(n-2^k); if 2^(k+1) < n <= 3*2^k, a(n) = a(n-2^k) + 2^k. - Henry Bottomley, Jan 10 2001
a(n) = n XOR [n/2] XOR [n/4] XOR [n/8] ... XOR [n/2^m] where m = [log(n)/log(2)] (for n>0) and [x] is integer floor of x. - Paul D. Hanna, Jun 04 2002
a(n) XOR [a(n)/2] = n. - Paul D. Hanna, Jan 18 2012
A066194(n) = a(n-1) + 1, n>=1. - Philippe Deléham, Apr 29 2005
a(n) = if n<2 then n else 2*m + (n mod 2 + m mod 2) mod 2, with m=a(floor(n/2)). - Reinhard Zumkeller, Aug 10 2010
a(n XOR m) = a(n) XOR a(m), where XOR is the bitwise exclusive-or operator, A003987. - Peter Munn, Dec 14 2019
a(0) = 0. For all n >= 0 if a(n) is even 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). - Yosu Yurramendi, Oct 12 2021
Conjecture: a(n) = a(A053645(A063946(n))) + A053644(n) for n > 0 with a(0) = 0. - Mikhail Kurkov, Sep 09 2023
a(n) = 2*A265263(n) - 2*A377404(n) - A010060(n). - Alan Michael Gómez Calderón, Jun 26 2025

Extensions

More terms from Henry Bottomley, Jan 10 2001

A075427 a(0) = 1; a(n) = a(n-1)+1 if n is even, otherwise a(n) = 2*a(n-1).

Original entry on oeis.org

1, 2, 3, 6, 7, 14, 15, 30, 31, 62, 63, 126, 127, 254, 255, 510, 511, 1022, 1023, 2046, 2047, 4094, 4095, 8190, 8191, 16382, 16383, 32766, 32767, 65534, 65535, 131070, 131071, 262142, 262143, 524286, 524287, 1048574, 1048575, 2097150, 2097151, 4194302, 4194303, 8388606
Offset: 0

Views

Author

Reinhard Zumkeller, Sep 15 2002

Keywords

Comments

Fixed points for permutations A180200, A180201, A180198, and A180199. - Reinhard Zumkeller, Aug 15 2010
The Kn22 sums, see A180662, of triangle A194005 equal the terms of this sequence. - Johannes W. Meijer, Aug 16 2011

Crossrefs

Cf. A075426, A066880, A083416, A000225 (bisection), A000918 (bisection).

Programs

  • Haskell
    a075427 n = a075427_list !! n
    a075427_list = 1 : f 1 1 where
       f x y = z : f (x + 1) z where z = (1 + x `mod` 2) * y + 1 - x `mod` 2
    -- Reinhard Zumkeller, Feb 27 2012
    
  • Magma
    [2^Floor((n+3)/2)-3/2+(-1)^n/2: n in [0..30]]; // Vincenzo Librandi, Aug 17 2011
    
  • Maple
    A075427 := proc(n) if type(n,'even') then 2^(n/2+1)-1 ; else 2^(1+(n+1)/2)-2 ; end if; end proc: seq(A075427(n), n=0..40); # R. J. Mathar, Feb 18 2011
    isA := proc(n) convert(n, base, 2): 1 - %[1] = nops(%) - add(%) end:
    select(isA, [$1..4095]); # Peter Luschny, Oct 27 2022
  • Mathematica
    a[0]=1; a[n_]:=a[n]=If[EvenQ[n],a[n-1]+1,2*a[n-1]]; Table[a[n],{n,0,40}] (* Jean-François Alcover, Mar 20 2011 *)
    nxt[{n_,a_}]:={n+1,If[OddQ[n],a+1,2a]}; Transpose[NestList[nxt,{0,1},40]][[2]] (* or *) LinearRecurrence[{0,3,0,-2},{1,2,3,6},50] (* Harvey P. Dale, Mar 12 2016 *)
  • PARI
    a(n)=2^((n+3)\2)-3/2+(-1)^n/2 \\ Charles R Greathouse IV, Feb 06 2017
    
  • Python
    def A075427(n): return (1<<(n>>1)+2)-2 if n&1 else (1<<(n>>1)+1)-1 # Chai Wah Wu, Apr 23 2023

Formula

a(0) = 1; for n >= 1, a(2*n) = 2^(n+1)-1, a(2*n-1) = 2^(n+1)-2; a(n) = 2^floor((n+3)/2) - 3/2 + (-1)^n/2. - Benoit Cloitre, Sep 17 2002 [corrected by Robert FERREOL, Jan 26 2011]
a(n) = (-1)^n/2 - 3/2 + 2^(n/2)*(1 + sqrt(2) + (1-sqrt(2))*(-1)^n). - Paul Barry, Apr 22 2004
From Paul Barry, Jul 30 2004: (Start)
Interleaved Mersenne numbers: interleaves 2*2^n-1 and 2(2*2^n-1) (A000225(n+1) and 2*A000225(n+1)).
G.f.: (1+2*x)/((1-x^2)*(1-2*x^2));
a(n) = 3*a(n-2) - 2*a(n-4);
a(n) = Sum_{k=0..n} binomial(floor((n+1)/2), floor((k+1)/2)). (End)
For n > 0: a(n) = (1 + n mod 2) * a(n-1) + 1 - (n mod 2). - Reinhard Zumkeller, Feb 27 2012
E.g.f.: 2*(cosh(sqrt(2)*x) - sinh(x) + sqrt(2)*sinh(sqrt(2)*x)) - cosh(x). - Stefano Spezia, Jul 11 2023
From Alois P. Heinz, Dec 27 2023: (Start)
a(n) = 2^floor((n+3)/2)-1-(n mod 2).
a(n) = A066880(n) for n>=1. (End)

Extensions

Formulae corrected and minor edits by Johannes W. Meijer, Aug 16 2011

A154435 Permutation of nonnegative integers induced by Lamplighter group generating wreath recursion, variant 3: a = s(b,a), b = (a,b), starting from the state a.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jan 17 2009

Keywords

Comments

This permutation is induced by the third Lamplighter group generating wreath recursion a = s(b,a), b = (a,b) (i.e., binary transducer, where s means that the bits at that state are toggled: 0 <-> 1) given on page 104 of Bondarenko, Grigorchuk, et al. paper, starting from the active (swapping) state a and rewriting bits from the second most significant bit to the least significant end.

Examples

			475 = 111011011 in binary. Starting from the second most significant bit and, as we begin with the swapping state a, we complement the bits up to and including the first zero encountered and so the beginning of the binary expansion is complemented as 1001....., then, as we switch to the inactive state b, the following bits are kept same, again up to and including the first zero encountered, after which the binary expansion is 1001110.., after which we switch again to the active state (state a), which complements the two rightmost 1's and we obtain the final answer 100111000, which is 312's binary representation, thus a(475)=312.
		

Crossrefs

Inverse: A154436. a(n) = A059893(A154437(A059893(n))) = A054429(A006068(A054429(n))). Corresponds to A122301 in the group of Catalan bijections. Cf. also A153141-A153142, A154439-A154448, A072376.

Programs

  • Python
    from sympy import floor
    def a006068(n):
        s=1
        while True:
            ns=n>>s
            if ns==0: break
            n=n^ns
            s<<=1
        return n
    def a054429(n): return 1 if n==1 else 2*a054429(floor(n/2)) + 1 - n%2
    def a(n): return 0 if n==0 else a054429(a006068(a054429(n))) # Indranil Ghosh, Jun 11 2017
    
  • R
    maxn <- 63 # by choice
    a <- c(1,3,2) # If it were a <- 1:3, it would be A180200
    for(n in 2:maxn){
      a[2*n  ] <- 2*a[n] + (a[n]%%2 == 0)
      a[2*n+1] <- 2*a[n] + (a[n]%%2 != 0)  }
    a
    # Yosu Yurramendi, Jun 21 2020

Extensions

Spelling/notation corrections by Charles R Greathouse IV, Mar 18 2010

A233279 Permutation of nonnegative integers: a(n) = A054429(A006068(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Dec 18 2013

Keywords

Comments

This permutation transforms the enumeration system of positive irreducible fractions A007305/A047679 (Stern-Brocot) into the enumeration system A071766/A229742 (HCS), and the enumeration system A162909/A162910 (Bird) into A245325/A245326. - Yosu Yurramendi, Jun 09 2015

Crossrefs

Inverse permutation: A233280.

Programs

  • Mathematica
    Module[{nn = 6, s}, s = Flatten[Table[Range[2^(n + 1) - 1, 2^n, -1], {n, 0, nn}]]; Map[If[# == 0, 0, s[[#]]] &, Table[Fold[BitXor, n, Quotient[n, 2^Range[BitLength[n] - 1]]], {n, 0, 2^nn}]]] (* Michael De Vlieger, Apr 06 2017, after Harvey P. Dale at A054429 and Jan Mangaldan at A006068 *)
  • Python
    from sympy import floor
    def a006068(n):
        s=1
        while True:
            ns=n>>s
            if ns==0: break
            n=n^ns
            s<<=1
        return n
    def a054429(n): return 1 if n==1 else 2*a054429(floor(n/2)) + 1 - n%2
    def a(n): return 0 if n==0 else a054429(a006068(n)) # Indranil Ghosh, Jun 11 2017
  • R
    maxrow <- 8 # by choice
    a <- 1:3
    for(m in 0:maxrow) for(k in 0:(2^m-1)){
    a[2^(m+2)+            k] <- a[2^(m+1)+    k] + 2^(m+1)
    a[2^(m+2)+        2^m+k] <- a[2^(m+1)+2^m+k] + 2^(m+1)
    a[2^(m+2)+2^(m+1)+    k] <- a[2^(m+1)+2^m+k] + 2^(m+2)
    a[2^(m+2)+2^(m+1)+2^m+k] <- a[2^(m+1)+   +k] + 2^(m+2)
    }
    (a <- c(0,a))
    # Yosu Yurramendi, Apr 05 2017
    
  • R
    # Given n, compute a(n) by taking into account the binary representation of n
    maxblock <- 7 # by choice
    a <- 1
    for(n in 2:2^maxblock){
      ones <- which(as.integer(intToBits(n)) == 1)
      nbit <- as.integer(intToBits(n))[1:tail(ones, n = 1)]
      anbit <- nbit
      for(k in 2^(0:floor(log2(length(nbit))))  )
        anbit <- bitwXor(anbit, c(anbit[-(1:k)], rep(0,k))) # ?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, May 29 2021
    
  • Scheme
    (define (A233279 n) (A054429 (A006068 n)))
    

Formula

a(n) = A054429(A006068(n)).
a(n) = A006068(A063946(n)).
a(n) = A154435(A054429(n)).
a(n) = A180200(A258746(n)) = A117120(A180200(n)), n > 0. - Yosu Yurramendi, Apr 10 2017

A245326 Denominators of an enumeration system of the reduced nonnegative rational numbers.

Original entry on oeis.org

1, 2, 1, 3, 3, 2, 1, 5, 4, 5, 4, 3, 3, 2, 1, 8, 7, 7, 5, 8, 7, 7, 5, 5, 4, 5, 4, 3, 3, 2, 1, 13, 11, 12, 9, 11, 10, 9, 6, 13, 11, 12, 9, 11, 10, 9, 6, 8, 7, 7, 5, 8, 7, 7, 5, 5, 4, 5, 4, 3, 3, 2, 1, 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, 13, 11, 12, 9, 11
Offset: 1

Views

Author

Yosu Yurramendi, Jul 18 2014

Keywords

Comments

A245325(n)/a(n) enumerates all the reduced nonnegative rational numbers exactly once.
If the terms (n>0) are written as an array (in a left-aligned fashion) with rows of length 2^m, m = 0,1,2,3,...
1,
2, 1,
3, 3, 2,1,
5, 4, 5,4, 3, 3,2,1,
8, 7, 7,5, 8, 7,7,5, 5, 4, 5,4, 3, 3,2,1,
13,11,12,9,11,10,9,6,13,11,12,9,11,10,9,6,8,7,7,5,8,7,7,5,5,4,5,4,3,3,2,1,
then the sum of the m-th row is 3^m (m = 0,1,2,), and each column k is a Fibonacci sequence. These Fibonacci sequences are equal to Fibonacci sequences from A...... except for the first terms of those sequences.
If the rows are written in a right-aligned fashion:
1,
2,1,
3,3,2,1,
5,4,5,4,3,3,2,1,
8,7,7,5,8,7,7,5,5,4,5,4,3,3,2,1,
13,11,12,9,11,10,9,6,13,11,12,9,11,10,9,6,8,7,7,5,8,7,7,5,5,4,5,4,3,3,2,1,
then each column is constant and the terms are from A071585 (a(2^m-1-k) = A071585(k), k = 0,1,2,...).
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 the Stern-Brocot sequence), and, more precisely, the reverses of blocks of A071766 (a(2^m+k) = A071766(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 A245328.

Crossrefs

Programs

  • PARI
    a(n) = my(A=1); for(i=0, logint(n, 2), if(bittest(2*n, i), A++, A=(A+1)/A)); denominator(A) \\ Mikhail Kurkov, Feb 20 2023
  • R
    blocklevel <- 6 # arbitrary
    a <- 1
    for(m in 0:blocklevel) for(k in 0:(2^(m-1)-1)){
      a[2^(m+1)+k]             <- a[2^m+k] + a[2^m+2^(m-1)+k]
      a[2^(m+1)+2^(m-1)+k]     <- a[2^(m+1)+k]
      a[2^(m+1)+2^m+k]         <- a[2^m+k]
      a[2^(m+1)+2^m+2^(m-1)+k] <- a[2^m+2^(m-1)+k]
    }
    a
    

Formula

a(n) = A002487(1+A059893(A180200(n))) = A002487(A059893(A154435(n))). - Yosu Yurramendi, Sep 20 2021

A245325 Numerators of an enumeration system of the reduced nonnegative rational numbers.

Original entry on oeis.org

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

Views

Author

Yosu Yurramendi, Jul 18 2014

Keywords

Comments

a(n)/A245326(n) enumerates all the reduced nonnegative rational numbers exactly once.
If the terms (n>0) are written as an array (in a left-aligned fashion) with rows of length 2^m, m = 0,1,2,3,...
1,
1,2,
2,1,3,3,
3,3,2,1,5,4,5,4,
5,4,5,4,3,3,2,1,8,7,7,5,8,7,7,5,
8,7,7,5,8,7,7,5,5,4,5,4,3,3,2,1,13,11,12,9,11,10,9,6,13,11,12,9,11,10,9,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, 1,3,3,
3, 3, 2,1, 5, 4,5,4,
5, 4, 5,4, 3, 3,2,1, 8, 7, 7,5, 8, 7,7,5,
8,7,7,5,8,7,7,5,5,4,5,4,3,3,2,1,13,11,12,9,11,10,9,6,13,11,12,9,11,10,9,6,
then 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,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 the Stern-Brocot sequence), and, more precisely, the reverses of blocks of A229742 (a(2^m+k) = A229742(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 A245327.

Crossrefs

Programs

  • R
    blocklevel <- 6 # arbitrary
    a <- 1
    for(m in 0:blocklevel) for(k in 0:(2^(m-1)-1)){
      a[2^(m+1)+k]             <- a[2^m+2^(m-1)+k]
      a[2^(m+1)+2^(m-1)+k]     <- a[2^m+k]
      a[2^(m+1)+2^m+k]         <- a[2^(m+1)+k] +  a[2^m+k]
      a[2^(m+1)+2^m+2^(m-1)+k] <- a[2^(m+1)+2^m+k]
    }
    a

Formula

a(n) = A002487(A059893(A180200(n))) = A002487(1+A059893(A154435(n))). - Yosu Yurramendi, Sep 20 2021

A064707 Inverse square of permutation defined by A003188.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Oct 13 2001

Keywords

Comments

Not the same as A100281: a(n)=A100281(n)=A099896(A099896(n)) only for n<64. - Reinhard Zumkeller, Nov 11 2004

Crossrefs

Inverse of permutation defined by A064706. Cf. A003188.

Programs

  • MATLAB
    A = 1; for i = 1:7 B = A(end:-1:1); A = [A (B + length(A))]; end C = A(A); for i = 1:128 A(C(i)) = i - 1; end A

Formula

a(n) = A180200(A233279(n)), n > 0. - Yosu Yurramendi, Apr 05 2017

Extensions

More terms from David Wasserman, Aug 02 2002

A180199 a(n) = A180201(A180201(n)).

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Aug 15 2010

Keywords

Comments

Permutation of the natural numbers with inverse A180198;
a(A180200(n)) = A180200(a(n)) = A180201(n);
a(A075427(n)) = A075427(n).

Programs

  • R
    nmax <- 31 # by choice
    a <- 1:3
    for(n in 1:nmax) for(k in 0:3){
    if(n %% 2 == 0) a[4*n + k] <- 2*a[2*n + (k == 2 | k == 3)] + (k == 0 | k == 2)
    else            a[4*n + k] <- 2*a[2*n + (k == 2 | k == 3)] + (k == 1 | k == 3)
    }
    (a <- c(0,a))
    # Yosu Yurramendi, Oct 25 2020
Showing 1-10 of 12 results. Next