login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A080412 Exchange rightmost two binary digits of n > 1; a(0)=0, a(1)=2. 12
0, 2, 1, 3, 4, 6, 5, 7, 8, 10, 9, 11, 12, 14, 13, 15, 16, 18, 17, 19, 20, 22, 21, 23, 24, 26, 25, 27, 28, 30, 29, 31, 32, 34, 33, 35, 36, 38, 37, 39, 40, 42, 41, 43, 44, 46, 45, 47, 48, 50, 49, 51, 52, 54, 53, 55, 56, 58, 57, 59, 60, 62, 61, 63, 64, 66, 65, 67, 68, 70, 69, 71, 72 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,2

COMMENTS

For n > 3: a(n) = 4*floor(n/4) + a(n mod 4); self-inverse permutation of the natural numbers: a(a(n)) = n.

Lodumo_2 of A021913. - Philippe Deléham, Apr 26 2009

The lodumo_m transformation of a list L is the list L' such that L'(n) is the smallest nonnegative integer not occurring earlier in L' and equal to L(n) (mod m). - M. F. Hasler, Dec 06 2010

From Franck Maminirina Ramaharo, Jul 20 2018: (Start)

Let

A: 0, 3,  8, 11, 16, 19, 24, 27, 32, 35, 40, 43, 48, 51, 56, 59, ... A047470

B: 1, 6,  9, 14, 17, 22, 25, 30, 33, 38, 41, 46, 49, 54, 57, 62, ... A047452

C: 2, 5, 10, 13, 18, 21, 26, 29, 34, 37, 42, 45, 50, 53, 58, 61, ... A047617

D: 4, 7, 12, 15, 20, 23, 28, 31, 36, 39, 44, 47, 52, 55, 60, 63, ... A047535.

Then the sequence is obtained by repeatedly picking terms from A,B,C,D according to the circuit A-C-B-A-D-B-C-D. The sequence begins:

A | C | B | A | D | B | C | D || A | C | B | A | D | ...

--+---+---+---+---+---+---+---++---+---+---+---+---+----

0 | 2 | 1 | 3 | 4 | 6 | 5 | 7 || 8 |10 | 9 |11 |12 | ...

(End)

LINKS

Vincenzo Librandi, Table of n, a(n) for n = 0..5000

Index entries for linear recurrences with constant coefficients, signature (1,0,0,1,-1).

Index entries for sequences that are permutations of the natural numbers

FORMULA

a(n) = a(n-1) + a(n-4) - a(n-5) for n > 4. - Joerg Arndt, Mar 11 2013

a(n) = lod_2(A021913(n)). - Philippe Deléham, Apr 26 2009

From Wesley Ivan Hurt, May 28 2016: (Start)

a(n) = n + 1 + (1+i)*(2*i-2-(1-i)*i^(2*n) + i^(-n)-i^(1+n))/4 where i=sqrt(-1).

G.f.: x*(2-x+2*x^2+x^3) / ((x-1)^2*(1+x+x^2+x^3)). (End)

E.g.f.: (sin(x) + cos(x) + (2*x + 1)*sinh(x) + (2*x - 1)*cosh(x))/2. - Ilya Gutkovskiy, May 28 2016

EXAMPLE

a(20) = a('101'00') = '101'00' = 20; a(21) = a('101'01') = '101'10' = 22.

a(2) = a('10') = '01' = 1; a(3) = a('11') = '11' = 3.

MAPLE

A080412:=n->n+1+(1+I)*(2*I-2-(1-I)*I^(2*n)+I^(-n)-I^(1+n))/4: seq(A080412(n), n=0..100); # Wesley Ivan Hurt, May 28 2016

MATHEMATICA

a[n_] := (bits = IntegerDigits[n, 2]; Join[Drop[bits, -2], {bits[[-1]], bits[[-2]]}] // FromDigits[#, 2]&); a[0]=0; a[1]=2; Table[a[n], {n, 0, 72}] (* Jean-François Alcover, Mar 11 2013 *)

ertbd[n_]:=Module[{a, b}, {a, b}=TakeDrop[IntegerDigits[n, 2], IntegerLength[ n, 2]-2]; FromDigits[Join[a, Reverse[b]], 2]]; Join[{0, 2}, Array[ertbd, 80, 2]] (* The program uses the TakeDrop function from Mathematica version 10 *) (* Harvey P. Dale, Jan 07 2016 *)

PROG

(GAP) a:=[0, 2, 1, 3, 4];; for n in [6..100] do a[n]:=a[n-1]+a[n-4]-a[n-5]; od; a; # Muniru A Asiru, Jul 27 2018

CROSSREFS

Cf. A004442, A007088, A021913, A080413, A080414.

Cf. A047470, A047452, A047617, A047535.

Sequence in context: A293517 A122514 A130077 * A300948 A098164 A158504

Adjacent sequences:  A080409 A080410 A080411 * A080413 A080414 A080415

KEYWORD

nonn,easy,nice

AUTHOR

Reinhard Zumkeller, Feb 17 2003

EXTENSIONS

Typo in example fixed by Reinhard Zumkeller, Jul 06 2009

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 16 13:54 EST 2018. Contains 317274 sequences. (Running on oeis4.)