login
Triangle in which first row is {1}; to get n-th row take first n numbers greater than last number in previous row which are relatively prime to n.
5

%I #10 Dec 05 2013 19:55:20

%S 1,3,5,7,8,10,11,13,15,17,18,19,21,22,23,25,29,31,35,37,41,43,44,45,

%T 46,47,48,50,51,53,55,57,59,61,63,65,67,68,70,71,73,74,76,77,79,81,83,

%U 87,89,91,93,97,99,101,103,104,105,106,107,108,109,111,112,113,114,115

%N Triangle in which first row is {1}; to get n-th row take first n numbers greater than last number in previous row which are relatively prime to n.

%H Reinhard Zumkeller, <a href="/A071977/b071977.txt">Rows n=1..120 of triangle, flattened</a>

%e Triangle begins 1; 3 5; 7 8 10; 11 13 15 17; 18 19 21 22 23; 25 29 31 35 37 41; ....

%t a = {1}; k = 2; Do[i = 1; While[i < n + 1, If[ GCD[k, n] == 1, a = Append[a, k]; i++ ]; k++ ], {n, 2, 12}]; a

%o (Haskell)

%o a071977 n k = a071977_tabl !! (n-1) !! (k-1)

%o a071977_row n = a071977_tabl !! (n-1)

%o a071977_tabl = f 1 [1..] where

%o f k xs = ys : f (k+1) (dropWhile (<= last ys) xs) where

%o ys = take k $ filter ((== 1) . (gcd k)) xs

%o -- _Reinhard Zumkeller_, Jan 18 2012

%Y Diagonals give A071978, A071979.

%Y A033291.

%K nonn,tabl

%O 1,2

%A _Amarnath Murthy_, Jun 18 2002

%E Edited by _Robert G. Wilson v_, Jun 28 2002