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

%I #16 Sep 17 2019 09:32:43

%S 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,

%T 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,

%U 4,5,8,9,10,12,13,14,16,17,19,20,22,23,24,25,26,29

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

%C A256946(n+1,T(n,k),k) = A256946(n,k), k = 1..n*(n+2);

%C T(n,k) = k for k = 1..n;

%C T(n,n+1) = n + 3;

%C T(n,n*(n+2)) = (n+2)^2 - 2.

%H Reinhard Zumkeller, <a href="/A256507/b256507.txt">Rows n = 1..30 of triangle, flattened</a>

%e . n | T(n,*) | A256946(n,*)

%e . ---+--------------------+--------------------------------------

%e . 1 | 1,4,7 | [1, 2, 3]

%e . 2 | 1,2,5,7,8,11,12,14 | [1,4, 5, 2,6, 7,3, 8]

%e . 3 | 1,2,3,6,7,9,11,... | [1,4,9,10,5,11,2,6,12,13,7,3,14,8,15] .

%t row[n_] := (* row of A256946 *) row[n] = SortBy[Range[n(n+2)], If[IntegerQ[ Sqrt[#]], 0, N[FractionalPart[Sqrt[#]]]]&];

%t T[n_, k_] := FirstPosition[row[n+1], row[n][[k]]][[1]];

%t Table[T[n, k], {n, 1, 5}, {k, 1, n(n+2)}] // Flatten (* _Jean-François Alcover_, Sep 17 2019 *)

%o (Haskell)

%o import Data.List (elemIndex); import Data.Maybe (fromJust)

%o a256507 n k = a256507_tabf !! (n-1) !! (k-1)

%o a256507_row n = a256507_tabf !! (n-1)

%o a256507_tabf = zipWith (\us vs ->

%o map ((+ 1) . fromJust . (`elemIndex` vs)) us)

%o a256946_tabf $ tail a256946_tabf

%Y Cf. A005563 (row lengths), A256946.

%K nonn,tabf

%O 1,2

%A _Reinhard Zumkeller_, Apr 22 2015