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

A065190 Self-inverse permutation of the positive integers: 1 is fixed, followed by an infinite number of adjacent transpositions (n n+1).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Oct 19 2001

Keywords

Comments

Also, a lexicographically minimal sequence of distinct positive integers such that a(n) is coprime to n. - Ivan Neretin, Apr 18 2015
The larger term of the pair (a(n), a(n+1)) is always odd. Had we started the sequence with a(1) = 0, it would be the lexicographically first sequence with this property if always extented with the smallest integer not yet present. - Eric Angelini, Feb 17 2017
From Yosu Yurramendi, Mar 21 2017: (Start)
This sequence is self-inverse. Except for the fixed point 1, it consists completely of 2-cycles: (2n, 2n+1), n > 0.
A020651(a(n)) = A020650(n), A020650(a(n)) = A020651(n), n > 0.
A245327(a(n)) = A245328(n), A245328(a(n)) = A245327(n), n > 0.
A063946(a(n)) = a(A063946(n)), n > 0.
A054429(a(n)) = a(A054429(n)) = A092569(n), n > 0.
A258996(a(n)) = a(A258996(n)), n > 0.
A258746(a(n)) = a(A258746(n)), n > 0. (End)
From Enrique Navarrete, Nov 13 2017: (Start)
With a(0)=0, and the rest of the sequence appended, a(n) is the smallest positive number not yet in the sequence such that the arithmetic mean of the first n+1 terms a(0), a(1), ..., a(n) is not an integer; i.e., the sequence is 0, 1, 3, 2, 5, 4, 7, 6, 9, 8, ...
Example: for n=5, (0 + 1 + 3 + 2 + 5)/5 is not an integer.
Fixed points are odd numbers >= 3 and also a(n) = n-2 for even n >= 4. (End)

Crossrefs

Programs

  • Magma
    [1] cat [n+(-1)^n: n in [2..80]]; // Vincenzo Librandi, Apr 18 2015
    
  • Maple
    [seq(f(j),j=1..120)]; f := (n) -> `if`((n < 2), n,n+((-1)^n));
  • Mathematica
    f[n_] := Rest@ Flatten@ Transpose[{Range[1, n + 1, 2], {1}~Join~Range[2, n, 2]}]; f@ 72 (* Michael De Vlieger, Apr 18 2015 *)
    Rest@ CoefficientList[Series[x (x^3 - 2 x^2 + 2 x + 1)/((x - 1)^2*(x + 1)), {x, 0, 72}], x] (* Michael De Vlieger, Feb 17 2017 *)
    Join[{1},LinearRecurrence[{1,1,-1},{3,2,5},80]] (* Harvey P. Dale, Feb 24 2021 *)
  • PARI
    { for (n=1, 1000, if (n>1, a=n + (-1)^n, a=1); write("b065190.txt", n, " ", a) ) } \\ Harry J. Smith, Oct 13 2009
    
  • PARI
    x='x+O('x^100); Vec(x*(x^3-2*x^2+2*x+1)/((x-1)^2*(x+1))) \\ Altug Alkan, Feb 04 2016
    
  • Python
    def a(n): return 1 if n<2 else n + (-1)**n # Indranil Ghosh, Mar 22 2017
    
  • R
    maxrow <- 8 # by choice
    a <- c(1,3,2) # If it were c(1,2,3), it would be A000027
      for(m in 1: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+k] + 2^(m+1)
    }
    a
    # Yosu Yurramendi, Apr 10 2017

Formula

a(1) = 1, a(n) = n+(-1)^n.
From Colin Barker, Feb 18 2013: (Start)
a(n) = a(n-1) + a(n-2) - a(n-3) for n>4.
G.f.: x*(x^3 - 2*x^2 + 2*x + 1) / ((x-1)^2*(x+1)). (End)
a(n)^a(n) == 1 (mod n). - Thomas Ordowski, Jan 04 2016
E.g.f.: x*(1+exp(x)) - 1 + exp(-x). - Robert Israel, Feb 04 2016
a(n) = A014681(n-1) + 1. - Michel Marcus, Dec 10 2016
a(1) = 1, for n > 0 a(2*n) = 2*a(a(n)) + 1, a(2*n + 1) = 2*a(a(n)). - Yosu Yurramendi, Dec 12 2020

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

A165754 a(n) = nimsum(n+(n+1)+(n+2)).

Original entry on oeis.org

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

Views

Author

Mick Purcell (mickpurcell(AT)gmail.com), Sep 26 2009

Keywords

Comments

Start with 3. Then repeat the cycle: subtract 3, add 5. The odd-indexed terms give the odd numbers, beginning with 3. The even-indexed terms give the even numbers, beginning with 0. In the infinite sequence, every positive integer except 1 is listed.

Examples

			For n = 3, Nimsum(3 + 4 + 5) = 2, as shown: 011 XOR 100 XOR 101 010.
		

Crossrefs

Cf. A065168. - R. J. Mathar, Sep 28 2009

Programs

  • Maple
    read("transforms") ; A165754 := proc(n) nimsum(nimsum(n,n+1),n+2) ; end: seq(A165754(n),n=0..120) ; # R. J. Mathar, Sep 28 2009
  • Mathematica
    Flatten[NestList[{Last[#]+5,Last[#]+2}&,{3,0},40]] (* Harvey P. Dale, Dec 04 2011 *)
  • PARI
    Vec((2*x^2-3*x+3)/((x-1)^2*(x+1)) + O(x^100)) \\ Colin Barker, Nov 05 2015
  • Python
    n = 0
    while n < 100:
        print(n^(n+1)^(n+2), end=',')
        n += 1
    

Formula

a(n) = 2*n-a(n-1)+1 (with a(0)=3). - Vincenzo Librandi, Dec 02 2010
a(n) = 1 + n + 2*(-1)^n. - R. J. Mathar, Dec 02 2010
From Colin Barker, Nov 05 2015: (Start)
a(n) = a(n-1) + a(n-2) - a(n-3) for n>2.
G.f.: (2*x^2-3*x+3) / ((x-1)^2*(x+1)). (End)
Sum_{n>=2} (-1)^(n+1)/a(n) = 4/3 - log(2). - Amiram Eldar, Sep 10 2023

Extensions

Extended by R. J. Mathar, Sep 28 2009
Showing 1-3 of 3 results.