

A088643


Triangle read by rows: row n >= 1 is obtained as follows. Start with n, next term is always largest number m with 1 <= m < n which has not yet appeared in that row and such that m + previous term in the row is a prime. Stop when no further m can be found.


12



1, 2, 1, 3, 2, 1, 4, 3, 2, 1, 5, 2, 3, 4, 1, 6, 5, 2, 3, 4, 1, 7, 6, 5, 2, 3, 4, 1, 8, 5, 6, 7, 4, 3, 2, 1, 9, 8, 5, 6, 7, 4, 3, 2, 1, 10, 9, 8, 5, 6, 7, 4, 3, 2, 1, 11, 8, 9, 10, 7, 6, 5, 2, 3, 4, 1, 12, 11, 8, 9, 10, 7, 6, 5, 2, 3, 4, 1, 13, 10, 9, 8, 11, 12, 7, 6, 5, 2, 3, 4, 1, 14, 9, 10, 13, 6, 11, 12
(list;
table;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

It is conjectured that row n is always a permutation of {1..n}. This has been verified for n <= 400000.
Presumably many of the rows, when read from right to left, match the infinite sequence A055265.
A255313(n,k) = T(n,k1) + T(n,k), n > 0 and 1 <= k <= n.  Reinhard Zumkeller, Feb 22 2015


REFERENCES

F. W. Roush and D. G. Rogers, A prime algorithm?, preprint, 1999.


LINKS

Reinhard Zumkeller, Rows n = 1..150 of triangle, flattened
J. W. Roche, Letter regarding "M. J. Kenney and S. J. Bezuszka, Calendar problem 12, 1997", Mathematics Teacher, 91 (1998), 155.


EXAMPLE

For example, the 20th row is 20, 17, 14, 15, 16, 13, 18, 19, 12, 11, 8, 9, 10, 7, 6, 5, 2, 3, 4, 1.
Triangle begins:
1
2 1
3 2 1
4 3 2 1
5 2 3 4 1
6 5 2 3 4 1


MATHEMATICA

Clear[t]; t[n_, 1] := n; t[n_, k_] := t[n, k] = For[m = n1, m >= 1, m, If[ PrimeQ[m + t[n, k1] ] && FreeQ[ Table[ t[n, j], {j, 1, k1} ], m], Return[m] ] ]; Table[ t[n, k], {n, 1, 14}, {k, 1, n} ] // Flatten (* JeanFrançois Alcover, Apr 03 2013 *)


PROG

(Haskell)
import Data.List (delete)
a088643_tabl = map a088643_row [1..]
a088643 n k = a088643_row n !! (k1)
a088643_row n = n : f n [n1, n2 .. 1] 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

A088631 and A088861 give second and third columns.
Cf. A049476, A049477, A049478.
Cf. A255313, A255316.
Sequence in context: A233742 A194856 A278703 * A226620 A194877 A102482
Adjacent sequences: A088640 A088641 A088642 * A088644 A088645 A088646


KEYWORD

nonn,tabl,nice,easy


AUTHOR

N. J. A. Sloane, Nov 24 2003


EXTENSIONS

More terms from David Wasserman, Aug 16 2005


STATUS

approved



