login
Irregular triangle T(n,m): nonprime 1 <= k <= n such that n and k are coprime.
1

%I #18 Dec 07 2019 12:18:29

%S 1,1,1,1,1,4,1,1,4,6,1,1,4,8,1,9,1,4,6,8,9,10,1,1,4,6,8,9,10,12,1,9,1,

%T 4,8,14,1,9,15,1,4,6,8,9,10,12,14,15,16,1,1,4,6,8,9,10,12,14,15,16,18,

%U 1,9,1,4,8,10,16,20,1,9,15,21,1,4,6,8,9,10

%N Irregular triangle T(n,m): nonprime 1 <= k <= n such that n and k are coprime.

%C Row n is a subset of A038566(n) such that the union of a(n) and A112484(n) = A038566(n).

%C Row lengths are A048864(n) = A000010(n)-(A000720(n)-A001221(n)), i.e., phi(n)-(pi(n)-omega(n)).

%C 1 appears in every row since 1 is not prime and coprime to all n.

%C 4 is the smallest composite and appears first in row 5 since 4 divides 4.

%C Rows that contain the single term 1 are in A048597; the largest n = 30 such that the only term is 1.

%C For prime p, row p contains 1 and all composites k < p, since 1 < m < p are coprime to p.

%H Michael De Vlieger, <a href="/A285788/b285788.txt">Table of n, a(n) for n = 1..11055</a> (rows 1 <= n <= 240)

%e Triangle begins:

%e n\m 1 2 3 4 5 6 7

%e 1: 1

%e 2: 1

%e 3: 1

%e 4: 1

%e 5: 1 4

%e 6: 1

%e 7: 1 4 6

%e 8: 1

%e 9: 1 4 8

%e 10: 1 9

%e 11: 1 4 6 8 9 10

%e 12: 1

%e 13: 1 4 6 8 9 10 12

%e 14: 1 9

%e 15: 1 4 8 14

%e 16: 1 9 15

%e ...

%t Table[Select[Range@ n, And[! PrimeQ@ #, CoprimeQ[#, n]] &], {n, 23}] // Flatten

%o (Python)

%o from sympy import gcd, isprime

%o def a(n): return list(filter(lambda k: isprime(k)==0 and gcd(k, n)==1, range(1, n + 1)))

%o for n in range(1, 21): print a(n) # _Indranil Ghosh_, Apr 26 2017

%Y Cf. A038566, A048597, A048864, A112484.

%K nonn,easy,tabf

%O 1,6

%A _Michael De Vlieger_, Apr 26 2017