login
Array where n-th row contains the primes < n and coprime to n.
5

%I #33 May 02 2021 21:43:16

%S 2,3,2,3,5,2,3,5,3,5,7,2,5,7,3,7,2,3,5,7,5,7,11,2,3,5,7,11,3,5,11,13,

%T 2,7,11,13,3,5,7,11,13,2,3,5,7,11,13,5,7,11,13,17,2,3,5,7,11,13,17,3,

%U 7,11,13,17,19,2,5,11,13,17,19,3,5,7,13,17,19,2,3,5,7,11,13,17,19,5,7,11,13

%N Array where n-th row contains the primes < n and coprime to n.

%C Array's n-th row contains A048865(n) terms.

%C T(A005408(n),1) = 2; T(n,1) = A053669(n). - _Reinhard Zumkeller_, Sep 23 2011

%C These are the primes in row n >= 3 of A038566 (smallest positive restricted residue system modulo n). - _Wolfdieter Lang_, Jan 18 2017

%H Michael De Vlieger, <a href="/A112484/b112484.txt">Table of n, a(n) for n = 3..16603</a> (rows 3 <= n <= 400).

%e Row 9 is [2, 5, 7], since 2, 5 and 7 are the primes < 9 and coprime to 9.

%e The irregular triangle begins:

%e n\k 1 2 3 4 5 6 7 8 ...

%e 3: 2

%e 4: 3

%e 5: 2 3

%e 6: 5

%e 7: 2 3 5

%e 8: 3 5 7

%e 9: 2 5 7

%e 10: 3 7

%e 11: 2 3 5 7

%e 12: 5 7 11

%e 13: 2 3 5 7 11

%e 14: 3 5 11 13

%e 15: 2 7 11 13

%e 16: 3 5 7 11 13

%e 17: 2 3 5 7 11 13

%e 18: 5 7 11 13 17

%e 19: 2 3 5 7 11 13 17

%e 20: 3 7 11 13 17 19

%e 21: 2 5 11 13 17 19

%e 22: 3 5 7 13 17 19

%e 23: 2 3 5 7 11 13 17 19

%e ... - _Wolfdieter Lang_, Jan 18 2017

%t f[l_] := Block[{n}, n = Length[l] + 1; Return[Append[l, Select[Range[n - 1], PrimeQ[ # ] && Mod[n, # ] > 0 &]]];]; Flatten[Nest[f, {}, 24]] (* _Ray Chandler_, Dec 26 2005 *)

%t Table[Complement[Prime@ Range@ PrimePi@ n, FactorInteger[n][[All, 1]]], {n, 3, 23}] // Flatten (* _Michael De Vlieger_, Sep 04 2017 *)

%o (Python)

%o from sympy import primerange, gcd

%o def a(n): return [i for i in primerange(1, n) if gcd(i, n)==1]

%o for n in range(3, 24): print(a(n)) # _Indranil Ghosh_, Apr 27 2017

%Y Cf. A038566, A048865, A053669.

%K nonn,tabf

%O 3,1

%A _Leroy Quet_, Dec 13 2005

%E Extended by _Ray Chandler_, Dec 26 2005