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.

A256507 Triangle read by rows, giving in triangle A256946 the positions of n-th's row terms in row n+1.

Original entry on oeis.org

1, 4, 7, 1, 2, 5, 7, 8, 11, 12, 14, 1, 2, 3, 6, 7, 9, 11, 12, 13, 16, 17, 19, 20, 22, 23, 1, 2, 3, 4, 7, 8, 10, 11, 13, 14, 16, 17, 18, 19, 22, 23, 24, 26, 27, 28, 30, 31, 33, 34, 1, 2, 3, 4, 5, 8, 9, 10, 12, 13, 14, 16, 17, 19, 20, 22, 23, 24, 25, 26, 29
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 22 2015

Keywords

Comments

A256946(n+1,T(n,k),k) = A256946(n,k), k = 1..n*(n+2);
T(n,k) = k for k = 1..n;
T(n,n+1) = n + 3;
T(n,n*(n+2)) = (n+2)^2 - 2.

Examples

			.  n | T(n,*)             | A256946(n,*)
. ---+--------------------+--------------------------------------
.  1 | 1,4,7              | [1,            2,          3]
.  2 | 1,2,5,7,8,11,12,14 | [1,4,     5,   2,6,      7,3,   8]
.  3 | 1,2,3,6,7,9,11,... | [1,4,9,10,5,11,2,6,12,13,7,3,14,8,15] .
		

Crossrefs

Cf. A005563 (row lengths), A256946.

Programs

  • Haskell
    import Data.List (elemIndex); import Data.Maybe (fromJust)
    a256507 n k = a256507_tabf !! (n-1) !! (k-1)
    a256507_row n = a256507_tabf !! (n-1)
    a256507_tabf = zipWith (\us vs ->
                           map ((+ 1) . fromJust . (`elemIndex` vs)) us)
                           a256946_tabf $ tail a256946_tabf
  • Mathematica
    row[n_] := (* row of A256946 *) row[n] = SortBy[Range[n(n+2)], If[IntegerQ[ Sqrt[#]], 0, N[FractionalPart[Sqrt[#]]]]&];
    T[n_, k_] := FirstPosition[row[n+1], row[n][[k]]][[1]];
    Table[T[n, k], {n, 1, 5}, {k, 1, n(n+2)}] // Flatten (* Jean-François Alcover, Sep 17 2019 *)