OFFSET
1,2
COMMENTS
LINKS
Reinhard Zumkeller, Rows n = 1..30 of triangle, flattened
EXAMPLE
. 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] .
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Reinhard Zumkeller, Apr 22 2015
STATUS
approved