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

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

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

A180200 a(0)=0, a(1)=1; for n > 1, a(n) = 2*m + 1 - (n mod 2 + m mod 2) mod 2, where m = a(floor(n/2)).

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Aug 15 2010

Keywords

Comments

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

Crossrefs

Programs

  • C
    #include 
    int a(int n){
        int m;
        if (n<2){return n;}
        else{
            m=a(n/2);
            return 2*m  + 1 - (n%2 + m%2)%2;
        }
    }
    int main()
    {
        int n=0;
        for(; n<=100; n++)
        printf("%d, ", a(n));
        return 0;
    } /* Indranil Ghosh, Apr 05 2017 */
    
  • Maple
    a:= proc(n) option remember; `if`(n<2, n, (m->
          2*m+1-irem(m+n, 2))(a(iquo(n, 2))))
        end:
    seq(a(n), n=0..72);  # Alois P. Heinz, May 29 2021
  • Mathematica
    a[0] = 0; a[1] = 1; a[n_] := a[n] = 2 # + 1 - Mod[Mod[n, 2] + Mod[#, 2], 2] &@ a[Floor[n/2]]; Table[a@ n, {n, 0, 72}] (* Michael De Vlieger, Apr 02 2017 *)
  • PARI
    a(n) = if(n<2, n, my(m=a(n\2)); 2*m + 1 - (n%2 + m%2)%2); \\ Indranil Ghosh, Apr 05 2017
    
  • Python
    def a(n):
        if n<2:return n
        else:
            m=a(n//2)
            return 2*m + 1 - (n%2 + m%2)%2 # Indranil Ghosh, Apr 05 2017
    
  • R
    maxn <- 63 # by choice
    a <- 1
    for(n in 1:maxn){
    a[2*n  ] <- 2*a[n] + (a[n]%%2 == 0)
    a[2*n+1] <- 2*a[n] + (a[n]%%2 != 0)}
    a <- c(0,a)
    # Yosu Yurramendi, May 23 2020

Formula

a(n) = A258746(A233279(n)) = A233279(A117120(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) + [a(n) even], a(2*n + 1) = 2*a(n) + [a(n) odd]. - Yosu Yurramendi, May 23 2020
a(n) = A054429(A154435(n)) = A006068(A054429(n)), n > 0. - Yosu Yurramendi, Jun 05 2021

Extensions

Name edited by Jon E. Schoenfield, Apr 05 2017

A064706 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, 20, 21, 22, 23, 17, 16, 19, 18, 30, 31, 28, 29, 27, 26, 25, 24, 40, 41, 42, 43, 45, 44, 47, 46, 34, 35, 32, 33, 39, 38, 37, 36, 60, 61, 62, 63, 57, 56, 59, 58, 54, 55, 52, 53, 51, 50, 49, 48, 80, 81, 82, 83, 85, 84, 87, 86
Offset: 0

Views

Author

N. J. A. Sloane, Oct 13 2001

Keywords

Comments

Inverse of sequence A064707 considered as a permutation of the nonnegative integers.
Not the same as A100282: a(n) = A100282(n) = A100280(A100280(n)) only for n < 64. - Reinhard Zumkeller, Nov 11 2004

Crossrefs

Cf. A064707 (inverse), A165211 (mod 2).
Cf. also A054238, A163233, A302846.

Programs

  • MATLAB
    A = 1; for i = 1:7 B = A(end:-1:1); A = [A (B + length(A))]; end A(A) - 1
    
  • Mathematica
    Array[BitXor[#, Floor[#/4]] &, 72, 0] (* Michael De Vlieger, Apr 14 2018 *)
  • PARI
    a(n)=bitxor(n,n\4)
    
  • PARI
    { for (n=0, 1000, write("b064706.txt", n, " ", bitxor(n, n\4)) ) } \\ Harry J. Smith, Sep 22 2009
    
  • Python
    def A064706(n): return n^ n>>2 # Chai Wah Wu, Jun 29 2022
  • R
    maxn <- 63 # by choice
    b <- c(1,0,0)
    for(n in 4:maxn) b[n] <- b[n-1] - b[n-2] + b[n-3]
    # c(1,b) is A133872
    a <- 1
    for(n in 1:maxn) {
    a[2*n  ] <- 2*a[n] + 1 - b[n]
    a[2*n+1] <- 2*a[n] +     b[n]
    }
    (a <- c(0,a))
    # Yosu Yurramendi, Oct 25 2020
    

Formula

a(n) = A003188(A003188(n)).
a(n) = n XOR floor(n/4), where XOR is binary exclusive OR. - Paul D. Hanna, Oct 25 2004
a(n) = A233280(A180201(n)), n > 0. - Yosu Yurramendi, Apr 05 2017
a(n) = A000695(A003188(A059905(n))) + 2*A000695(A003188(A059906(n))). - Antti Karttunen, Apr 14 2018

Extensions

More terms from David Wasserman, Aug 02 2002

A233280 Permutation of nonnegative integers: a(n) = A003188(A054429(n)).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 7, 6, 8, 9, 11, 10, 14, 15, 13, 12, 16, 17, 19, 18, 22, 23, 21, 20, 28, 29, 31, 30, 26, 27, 25, 24, 32, 33, 35, 34, 38, 39, 37, 36, 44, 45, 47, 46, 42, 43, 41, 40, 56, 57, 59, 58, 62, 63, 61, 60, 52, 53, 55, 54, 50, 51, 49, 48, 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 A071766/A229742 (HCS) into the enumeration system A007305/A047679 (Stern-Brocot), and the enumeration system A245325/A245326 into A162909/A162910 (Bird). - Yosu Yurramendi, Jun 09 2015

Crossrefs

Inverse permutation: A233279.
Similarly constructed permutation pairs: A003188/A006068, A135141/A227413, A232751/A232752, A233275/A233276, A233277/A233278, A193231 (self-inverse).

Programs

  • Python
    from sympy import floor
    def a003188(n): return n^(n>>1)
    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 a003188(a054429(n)) # Indranil Ghosh, Jun 11 2017
  • R
    maxrow <- 8 # by choice
    a <- 1
    for(m in 0:maxrow) for(k in 0:(2^m-1)){
    a[2^(m+1)+    k] <- a[2^m+      k] + 2^m
    a[2^(m+1)+2^m+k] <- a[2^(m+1)-1-k] + 2^(m+1)
    }
    a
    # Yosu Yurramendi, Apr 05 2017
    
  • Scheme
    (define (A233280 n) (A003188 (A054429 n)))
    ;; Alternative version, based on entangling even & odd numbers with odious and evil numbers:
    (definec (A233280 n) (cond ((< n 2) n) ((even? n) (A000069 (+ 1 (A233280 (/ n 2))))) (else (A001969 (+ 1 (A233280 (/ (- n 1) 2)))))))
    

Formula

a(n) = A003188(A054429(n)).
a(n) = A063946(A003188(n)).
a(n) = A054429(A154436(n)).
a(0)=0, a(1)=1, and otherwise, a(2n) = A000069(1+a(n)), a(2n+1) = A001969(1+a(n)). [A recurrence based on entangling even & odd numbers with odious and evil numbers]
a(n) = A258746(A180201(n)) = A180201(A117120(n)), n > 0. - Yosu Yurramendi, Apr 10 2017

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

Showing 1-6 of 6 results.