login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A132163 Triangle read by rows. For row n, start with 1 but from the second term onwards always choose the largest positive integer between 1 and n inclusive that i) has not already appeared in the row ii) gives a prime when added to the previous term. Stop if no such integer can be found. 2

%I #13 Nov 26 2015 17:13:14

%S 1,1,2,1,2,3,1,4,3,2,1,4,3,2,5,1,6,5,2,3,4,1,6,7,4,3,2,5,1,6,7,4,3,8,

%T 5,2,1,6,7,4,9,8,5,2,3,1,10,9,8,5,6,7,4,3,2,1,10,9,8,11,6,7,4,3,2,5,1,

%U 12,11,8,9,10,7,6,5,2,3,4

%N Triangle read by rows. For row n, start with 1 but from the second term onwards always choose the largest positive integer between 1 and n inclusive that i) has not already appeared in the row ii) gives a prime when added to the previous term. Stop if no such integer can be found.

%C 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.)

%H Reinhard Zumkeller, <a href="/A132163/b132163.txt">Rows n = 1..150 of triangle, flattened</a>

%t 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 *)

%o (Haskell)

%o import Data.List (delete)

%o a132163_tabl = map a132163_row [1..]

%o a132163 n k = a132163_row n !! (k-1)

%o a132163_row n = 1 : f 1 [n, n-1 .. 2] where

%o f u vs = g vs where

%o g [] = []

%o g (x:xs) | a010051 (x + u) == 1 = x : f x (delete x vs)

%o | otherwise = g xs

%o -- _Reinhard Zumkeller_, Jan 05 2013

%Y This sequence is a variation on A088643.

%K easy,nice,nonn,tabl

%O 1,3

%A _Paul Boddington_, Nov 04 2007

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 9 04:44 EDT 2024. Contains 372341 sequences. (Running on oeis4.)