A077664 Triangle in which the n-th row contains n smallest numbers greater than n and coprime to n.
2, 3, 5, 4, 5, 7, 5, 7, 9, 11, 6, 7, 8, 9, 11, 7, 11, 13, 17, 19, 23, 8, 9, 10, 11, 12, 13, 15, 9, 11, 13, 15, 17, 19, 21, 23, 10, 11, 13, 14, 16, 17, 19, 20, 22, 11, 13, 17, 19, 21, 23, 27, 29, 31, 33, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 13, 17, 19, 23, 25, 29, 31, 35, 37, 41, 43, 47
Offset: 1
Examples
Triangle begins: 2; 3, 5; 4, 5, 7; 5, 7, 9, 11; 6, 7, 8, 9, 11; 7, 11, 13, 17, 19, 23; 8, 9, 10, 11, 12, 13, 15; ...
Links
- Reinhard Zumkeller, Rows n = 1..125 of triangle, flattened
Programs
-
Haskell
a077664 n k = a077664_tabl !! (n-1) !! (k-1) a077664_row n = a077664_tabl !! (n-1) a077664_tabl = map (\x -> take x $ filter ((== 1). gcd x) [x + 1 ..]) [1..] -- Reinhard Zumkeller, Aug 03 2015
-
Mathematica
T[n_] := Module[{j, k}, Reap[For[j = n+1; k = 1, k <= n, j++, If[CoprimeQ[n, j], Sow[j]; k++]]][[2, 1]]]; Table[T[n], {n, 1, 12}] // Flatten (* Jean-François Alcover, Sep 21 2021 *)
-
Python
from math import gcd def arow(n): rown, k = [], n + 1 while len(rown) < n: if gcd(k, n) == 1: rown.append(k) k += 1 return rown def agen(rows): for n in range(1, rows+1): yield from arow(n) print([an for an in agen(12)]) # Michael S. Branicky, Sep 21 2021
Extensions
More terms from Sascha Kurz, Jan 03 2003
Comments