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.
%I A080412 #56 Jan 19 2023 02:15:32 %S A080412 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, %T A080412 25,27,28,30,29,31,32,34,33,35,36,38,37,39,40,42,41,43,44,46,45,47,48, %U A080412 50,49,51,52,54,53,55,56,58,57,59,60,62,61,63,64,66,65,67,68,70,69,71,72 %N A080412 Exchange rightmost two binary digits of n > 1; a(0)=0, a(1)=2. %C A080412 Self-inverse permutation of the natural numbers: a(a(n)) = n. %C A080412 Lodumo_2 of A021913. - _Philippe Deléham_, Apr 26 2009 %C A080412 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 %C A080412 From _Franck Maminirina Ramaharo_, Jul 20 2018: (Start) %C A080412 Let %C A080412 A: 0, 3, 8, 11, 16, 19, 24, 27, 32, 35, 40, 43, 48, 51, 56, 59, ... A047470 %C A080412 B: 1, 6, 9, 14, 17, 22, 25, 30, 33, 38, 41, 46, 49, 54, 57, 62, ... A047452 %C A080412 C: 2, 5, 10, 13, 18, 21, 26, 29, 34, 37, 42, 45, 50, 53, 58, 61, ... A047617 %C A080412 D: 4, 7, 12, 15, 20, 23, 28, 31, 36, 39, 44, 47, 52, 55, 60, 63, ... A047535. %C A080412 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: %C A080412 A | C | B | A | D | B | C | D || A | C | B | A | D | ... %C A080412 --+---+---+---+---+---+---+---++---+---+---+---+---+---- %C A080412 0 | 2 | 1 | 3 | 4 | 6 | 5 | 7 || 8 |10 | 9 |11 |12 | ... %C A080412 (End) %C A080412 The sequence is a permutation of the nonnegative integers partitioned into quadruples [4k, 4k+2, 4k+1, 4k+3] for k >= 0, i.e., the two interior terms of each quadruple are interchanged. - _Guenther Schrack_, Apr 22 2019 %H A080412 Vincenzo Librandi, <a href="/A080412/b080412.txt">Table of n, a(n) for n = 0..5000</a> %H A080412 <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,1,-1). %H A080412 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A080412 a(n) = 4*floor(n/4) + a(n mod 4), for n > 3. %F A080412 a(n) = a(n-1) + a(n-4) - a(n-5) for n > 4. - _Joerg Arndt_, Mar 11 2013 %F A080412 a(n) = lod_2(A021913(n)). - _Philippe Deléham_, Apr 26 2009 %F A080412 From _Wesley Ivan Hurt_, May 28 2016: (Start) %F A080412 a(n) = n + 1 + (1+i)*(2*i-2-(1-i)*i^(2*n) + i^(-n)-i^(1+n))/4 where i=sqrt(-1). %F A080412 G.f.: x*(2-x+2*x^2+x^3) / ((1-x)^2*(1+x+x^2+x^3)). (End) %F A080412 E.g.f.: (sin(x) + cos(x) + (2*x + 1)*sinh(x) + (2*x - 1)*cosh(x))/2. - _Ilya Gutkovskiy_, May 28 2016 %F A080412 From _Guenther Schrack_, Apr 23 2019: (Start) %F A080412 a(n) = (2*n - (-1)^n + (-1)^(n*(n-1)/2))/2. %F A080412 a(n) = a(n-4) + 4, a(0)=0, a(1)=2, a(2)=1, a(3)=3, for n > 3. (End) %e A080412 a(20) = a('101'00') = '101'00' = 20; a(21) = a('101'01') = '101'10' = 22. %e A080412 a(2) = a('10') = '01' = 1; a(3) = a('11') = '11' = 3. %p A080412 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 %t A080412 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, 80}] (* _Jean-François Alcover_, Mar 11 2013 *) %t A080412 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 *) %t A080412 CoefficientList[Series[x*(2-x+2*x^2+x^3)/((1-x)*(1-x^4)), {x,0,80}], x] (* _G. C. Greubel_, Apr 28 2019 *) %o A080412 (GAP) a:=[0,2,1,3,4];; for n in [6..80] do a[n]:=a[n-1]+a[n-4]-a[n-5]; od; a; # _Muniru A Asiru_, Jul 27 2018 %o A080412 (PARI) my(x='x+O('x^80)); concat([0], Vec(x*(2-x+2*x^2+x^3)/((1-x)*(1-x^4)))) \\ _G. C. Greubel_, Apr 28 2019 %o A080412 (Magma) R<x>:=PowerSeriesRing(Integers(), 80); [0] cat Coefficients(R!( x*(2-x+2*x^2+x^3)/((1-x)*(1-x^4)) )); // _G. C. Greubel_, Apr 28 2019 %o A080412 (Sage) (x*(2-x+2*x^2+x^3)/((1-x)*(1-x^4))).series(x, 80).coefficients(x, sparse=False) # _G. C. Greubel_, Apr 28 2019 %o A080412 (Python) %o A080412 def A080412(n): return (0,1,-1,0)[n&3]+n # _Chai Wah Wu_, Jan 18 2023 %Y A080412 Cf. A004442, A007088, A021913, A080413, A080414. %Y A080412 Cf. A047470, A047452, A047617, A047535. %K A080412 nonn,easy,nice %O A080412 0,2 %A A080412 _Reinhard Zumkeller_, Feb 17 2003 %E A080412 Typo in example fixed by _Reinhard Zumkeller_, Jul 06 2009