OFFSET
1,3
COMMENTS
The following statements are conjectural: 1) The n-th row is always a permutation of 1,...,n. 2) For the even rows, the last term is one less than a prime (so the row gives a solution to the prime circle problem - see A051252). 3) There exists a (unique) sequence b(2), b(3),... with the property that for every n > 1 there is a positive integer N such that every even row of the triangle from the 2N-th onwards ends b(n), ..., b(3), b(2) and every odd row from the (2N - 1)-th onwards ends b(n)+(-1)^n, ..., b(3)-1, b(2)+1. (If the sequence b(n) exists it is probably A132075 without the initial term 1.)
LINKS
Reinhard Zumkeller, Rows n = 1..150 of triangle, flattened
MATHEMATICA
t[_, 1] = 1; t[n_, k_] := t[n, k] = For[ j = n, j > 1, j--, If[ PrimeQ[ t[n, k-1] + j] && FreeQ[ Table[ t[n, m], {m, 1, k-1}], j], Return[j] ] ]; Table[ t[n, k], {n, 1, 12}, {k, 1, n}] // Flatten (* Jean-François Alcover, Apr 02 2013 *)
PROG
(Haskell)
import Data.List (delete)
a132163_tabl = map a132163_row [1..]
a132163 n k = a132163_row n !! (k-1)
a132163_row n = 1 : f 1 [n, n-1 .. 2] where
f u vs = g vs where
g [] = []
g (x:xs) | a010051 (x + u) == 1 = x : f x (delete x vs)
| otherwise = g xs
-- Reinhard Zumkeller, Jan 05 2013
CROSSREFS
KEYWORD
AUTHOR
Paul Boddington, Nov 04 2007
STATUS
approved