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.

A375301 Triangle T(n,k) read by rows with row n equal to the unique permutation pi_n of [1, ..., n] such that k + pi_n(k) is a power of 2 for 1 <= k <= n.

Original entry on oeis.org

1, 1, 2, 3, 2, 1, 3, 2, 1, 4, 1, 2, 5, 4, 3, 1, 6, 5, 4, 3, 2, 7, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, 2, 1, 8, 1, 6, 5, 4, 3, 2, 9, 8, 7, 1, 2, 5, 4, 3, 10, 9, 8, 7, 6, 3, 2, 1, 4, 11, 10, 9, 8, 7, 6, 5, 3, 2, 1, 12, 11, 10, 9, 8, 7, 6, 5, 4, 1, 2, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3
Offset: 1

Views

Author

Hugo Pfoertner, Aug 25 2024

Keywords

Examples

			The triangle begins
  1,
  1, 2,
  3, 2, 1,
  3, 2, 1, 4,
  1, 2, 5, 4, 3,
  1, 6, 5, 4, 3, 2,
  7, 6, 5, 4, 3, 2, 1,
  7, 6, 5, 4, 3, 2, 1, 8,
  ...
Row 5: [1, 2, 5, 4, 3] + [1, 2, 3, 4, 5] = [2, 4, 8, 8, 8]; only powers of 2 in the vector of sums.
		

Crossrefs

A375302 gives the rank of row n in lexicographically ordered permutations of [n].
Cf. A000079.

Programs

  • PARI
    a375301_row(n) = forperm(n, p, my(f=1); for(k=1, n, my(s=p[k]+k); if(2^valuation(s,2)!=s, f=0; break)); if(f==1, return(Vec(p))))