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.

A284307 Permutation of the natural numbers partitioned into quadruples [4k-3, 4k, 4k-2, 4k-1], k > 0.

Original entry on oeis.org

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

Views

Author

Guenther Schrack, Mar 24 2017

Keywords

Comments

Partition the natural number sequence into quadruples starting with (1, 2, 3, 4); swap the third and fourth element, then swap the second and third element; repeat for all quadruples.

Crossrefs

Inverse: A056699.
Subsequences:
elements with odd index: A042963(n), n > 0
elements with even index: A014601(A103889(n)), n > 0
odd elements: A005408(n-1), n > 0
indices of odd elements: A042948(n), n > 0
even elements: 2*A103889(n), n > 0
indices of even elements: A042964(n), n > 0
Sequence of fixed points: A016813(n-1), n > 0
Every fourth element starting at:
n=1: a(4n-3) = 4n-3 = A016813(n-1), n > 0
n=2: a(4n-2) = 4n = A008586(n), n > 0
n=3: a(4n-1) = 4n-2 = A016825(n-1), n > 0
n=4: a(4n) = 4n-1 = A004767(n-1), n > 0
Difference between pairs of elements:
a(2n+1)-a(2n-1) = A010684(n-1), n > 0
Compositions:
a(n) = A133256(A116966(n-1)), n > 0
a(A042948(n)) = A005408(n-1), n > 0
A067060(a(n)) = A092486(n), n > 0

Programs

  • MATLAB
    a = [1 4 2 3];
    max = (specify);
    for n = 5:max
       a(n) = a(n-4) + 4;
    end;
    
  • Mathematica
    Table[n + ((-1)^n - (-1)^(n (n - 1)/2) (1 + 2 (-1)^n))/2, {n, 68}] (* Michael De Vlieger, Mar 28 2017 *)
    LinearRecurrence[{1,0,0,1,-1},{1,4,2,3,5},70] (* or *) {#[[1]],#[[4]], #[[2]],#[[3]]}&/@Partition[Range[70],4]//Flatten(* Harvey P. Dale, Sep 27 2017 *)
  • PARI
    for(n=1, 68, print1(n + ((-1)^n - (-1)^(n*(n - 1)/2)*(1 + 2*(-1)^n))/2,", ")) \\ Indranil Ghosh, Mar 29 2017

Formula

a(1)=1, a(2)=4, a(3)=2, a(4)=3, a(n) = a(n-4) + 4, n > 4.
O.g.f.: (x^4 + x^3 - 2*x^2 + 3x - 1)/(x^5 - x^4 - x + 1).
a(n) = n + ((-1)^n - (-1)^(n*(n-1)/2)*(1 + 2*(-1)^n))/2.
a(n) = n + (-1)^n*(1 - (-1)^(n*(n-1)/2) - (i^n - (-i)^n))/2.
Linear recurrence: a(n) = a(n-1) + a(n-4) - a(n-5), n > 5.
First differences, periodic: (3, -2, 1, 2), repeat.
a(n) = (2*n - 3*cos(n*Pi/2) + cos(n*Pi) + sin(n*Pi/2))/2. - Wesley Ivan Hurt, Apr 01 2017

A298364 Permutation of the natural numbers partitioned into quadruples [4k-2, 4k-1, 4k-3, 4k] for k > 0.

Original entry on oeis.org

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

Views

Author

Guenther Schrack, Jan 18 2018

Keywords

Comments

Partition the natural number sequence into quadruples starting with (1,2,3,4); swap the first and second elements, then swap the second and third elements; repeat for all quadruples.

Crossrefs

Inverse: A292576.
Sequence of fixed points: A008586(n) for n > 0.
First differences: (-1)^floor(n^2/4)*A068073(n-1) for n > 0.
Subsequences:
elements with odd index: A042963(A103889(n)) for n > 0.
elements with even index A014601(n) for n > 0.
odd elements: A166519(n-1) for n > 0.
indices of odd elements: A042964(n) for n > 0.
even elements: A005843(n) for n > 0.
indices of even elements: A042948(n) for n > 0.
Other similar permutations: A116966, A284307, A292576.

Programs

  • MATLAB
    a = [2 3 1 4];
    max = 10000;    % Generation of b-file.
    for n := 5:max
       a(n) = a(n-4) + 4;
    end;
    
  • Mathematica
    Nest[Append[#, #[[-4]] + 4] &, {2, 3, 1, 4}, 63] (* or *)
    Array[# + ((-1)^# + ((-1)^(# (# - 1)/2)) (1 - 2 (-1)^#))/2 &, 67] (* Michael De Vlieger, Jan 23 2018 *)
    LinearRecurrence[{1,0,0,1,-1},{2,3,1,4,6},70] (* Harvey P. Dale, Dec 12 2018 *)
  • PARI
    for(n=1, 100, print1(n + ((-1)^n + ((-1)^(n*(n-1)/2))*(1 - 2*(-1)^n))/2, ", "))

Formula

O.g.f.: (3*x^3 - 2*x^2 + x + 2)/(x^5 - x^4 - x - 1).
a(1) = 2, a(2) = 3, a(3) = 1, a(4) = 4, a(n) = a(n-4) + 4 for n > 4.
a(n) = n + ((-1)^n + ((-1)^(n*(n-1)/2))*(1 - 2*(-1)^n))/2.
a(n) = n + (cos(n*Pi) - cos(n*Pi/2) + 3*sin(n*Pi/2))/2.
a(n) = 2*floor((n+1)/2) - 4*floor((n+1)/4) + floor(n/2) + 2*floor(n/4).
a(n) = n + (-1)^floor((n-1)^2/4)*A140081(n) for n > 0.
a(n) = A056699(n+1) - 1, n > 0.
a(n+2) = A168269(n+1) - a(n), n > 0.
a(n+2) = a(n) + (-1)^floor((n+1)^2/4)*A132400(n+2) for n > 0.
Linear recurrence: a(n) = a(n-1) + a(n-4) - a(n-5) for n > 5.
First differences: periodic, (1, -2, 3, 2) repeat.
Compositions:
a(n) = A080412(A116966(n-1)) for n > 0.
a(n) = A284307(A256008(n)) for n > 0.
a(A067060(n)) = A133256(n) for n > 0.
A116966(a(n+1)-1) = A092486(n) for n >= 0.
A056699(a(n)) = A256008(n) for n > 0.

A263694 Expansion of (1 + x + x^2 + x^3 + 4*x^4 - x^5 - x^6 - x^7 + 3*x^8)/((1 - x)^2*(1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7)).

Original entry on oeis.org

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

Views

Author

Ilya Gutkovskiy, Apr 17 2016

Keywords

Comments

In each group of 8 consecutive numbers, swap 5 and 8 terms, 6 and 7 terms.

Crossrefs

Programs

  • Mathematica
    CoefficientList[Series[(1 + x + x^2 + x^3 + 4 x^4 - x^5 - x^6 - x^7 + 3 x^8)/((1 - x)^2 (1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7)), {x, 0, 75}], x]
    LinearRecurrence[{1, 0, 0, 0, 0, 0, 0, 1, -1}, {1, 2, 3, 4, 8, 7, 6, 5, 9}, 75]
  • PARI
    x='x+O('x^99); Vec((1+x+x^2+x^3+4*x^4-x^5-x^6-x^7+3*x^8)/((1-x)^2*(1+x+x^2+x^3 +x^4+x^5+x^6+x^7))) \\ Altug Alkan, Apr 18 2016

Formula

G.f.: (1 + x + x^2 + x^3 + 4*x^4 - x^5 - x^6 - x^7 + 3*x^8)/((1 - x)^2*(1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7)).
a(n) = a(n-1) + a(n-8) - a(n-9).
a(n) = 1 + n + 3*floor(n/4) - 2*floor((n+1)/8) - 2*floor((n+2)/8) - 2*floor((n+3)/8). - Vaclav Kotesovec, Apr 19 2016
Showing 1-3 of 3 results.