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.

A376180 Triangle read by rows (blocks). Each row consists of a permutation of the numbers of its constituents. The length of row number n is the n-th pentagonal number n(3n-1)/2 = A000326(n); see Comments.

Original entry on oeis.org

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

Views

Author

Boris Putievskiy, Sep 14 2024

Keywords

Comments

A209278 presents an algorithm for generating permutations.
The sequence is an intra-block permutation of integer positive numbers.

Examples

			Triangle begins:
     k =  1   2   3   4   5   6   7   8   9  10  11  12
  n=1:    1;
  n=2:    4,  5,  3,  6,  2;
  n=3:   13, 12, 14, 11, 15, 10, 16,  9, 17,  8, 18,  7;
Subtracting (n-1)^2*n/2 from each term in row n is a permutation of 1 .. n(3n-1)/2:
  1;
  3,4,2,5,1;
  7,6,8,5,9,4,10,3,11,2,12,1;
		

Crossrefs

Programs

  • Mathematica
    a[n_]:=Module[{L,R,P,Result},L=Ceiling[Max[x/.NSolve[x^2 (x+1)-2 n==0,x,Reals]]];
    R=n-((L-1)^2)*L/2; P=Which[OddQ[R]&&OddQ[L*(3*L-1)/2],(L*(3*L-1)/2-R+2)/2,OddQ[R]&&EvenQ[L*(3*L-1)/2],(R+L*(3*L-1)/2+1)/2,EvenQ[R]&&OddQ[L*(3*L-1)/2],Ceiling[(L*(3*L-1)/2+1)/2]+R/2, EvenQ[R]&&EvenQ[L*(3*L-1)/2],Ceiling[(L*(3*L-1)/2+1)/2]-R/2 ];
    Result=P+(L-1)^2*L/2; Result]
    Nmax=18; Table[a[n],{n,1,Nmax}]

Formula

Linear sequence:
a(n) = P(n) + (L(n)-1)^2*L(n)/2. a(n) = P(n) + A002411(L(n)-1), where P = (L(n)(3L(n) - 1)/2 - R(n) + 2)/2 if R(n) is odd and L(n)(3L(n) - 1)/2 is odd, P = (R(n) + L(n)(3L(n) - 1)/2 + 1)/2 if R(n) is odd and L(n)(3L(n) - 1)/2 is even, P = ceiling((L(n)(3L(n) - 1)/2 + 1)/2) + R(n)/2 if R(n) is even and L(n)(3L(n) - 1)/2 is odd, P = ceiling((L(n)(3L(n) - 1)/2 + 1)/2) - R(n)/2 if R(n) is even and L(n)(3L(n) - 1)/2 is even. L(n) = ceiling(x(n)), x(n) is largest real root of the equation x^2*(x+1)-2*n = 0.
Triangular array T(n,k) for 1 <= k <= n(3n-1)/2 (see Example):
T(n,k) = P(n,k) + (n-1)^2*n/2, T(n,k) = P(n,k) + A002411(n-1), where P(n,k) = (n(3n - 1)/2 - k + 2)/2 if k is odd and n(3n - 1)/2 is odd,
P(n,k) = (k + n(3n - 1)/2 + 1)/2 if k is odd and n(3n - 1)/2 is even, P(n,k) = ceiling((n(3n - 1)/2 + 1)/2) + k/2 if k is even and n(3n - 1)/2 is odd, P(n,k) = ceiling((n(3n - 1)/2 + 1)/2) - k/2 if k is even and n(3n - 1)/2 is even.