login
Irregular triangle whose n-th row is a list of numbers that are infinitarily relatively prime to n (n = 2, 3, ...).
5

%I #25 Mar 26 2023 02:16:01

%S 1,1,2,1,2,3,1,2,3,4,1,4,5,1,2,3,4,5,6,1,3,5,7,1,2,3,4,5,6,7,8,1,3,4,

%T 7,9,1,2,3,4,5,6,7,8,9,10,1,2,5,7,9,10,11,1,2,3,4,5,6,7,8,9,10,11,12,

%U 1,3,4,5,9,11,12,13,1,2,4,7,8,9,11,13,14,1,2,3,4,5,6,7,8,9,10,11,12,13,14

%N Irregular triangle whose n-th row is a list of numbers that are infinitarily relatively prime to n (n = 2, 3, ...).

%C The integers less than n that have no common infinitary divisors with n.

%H Eric Weisstein, <a href="http://mathworld.wolfram.com/InfinitaryDivisor.html">Infinitary Divisor</a>.

%e irelprime[6] = {1, 4, 5} because iDivisors[6] = {1, 2, 3, 6} and iDivisors[4] = {1, 4} so 4 is infinitary_relatively_prime to 6 since it lacks common infinitary divisors with 6.

%e For n = 2 ..8 irelprime[n] gives {1}, {1,2}, {1,2,3}, {1,2,3,4}, {1,4,5}, {1,2,3,4,5,6}, {1,3,5,7}.

%e Triangle starts:

%e 2: 1;

%e 3: 1, 2;

%e 4: 1, 2, 3;

%e 5: 1, 2, 3, 4;

%e 6: 1, 4, 5;

%e 7: 1, 2, 3, 4, 5, 6;

%e 8: 1, 3, 5, 7;

%e 9: 1, 2, 3, 4, 5, 6, 7, 8;

%e 10: 1, 3, 4, 7, 9;

%e 11: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10;

%e 12: 1, 2, 5, 7, 9, 10, 11;

%e 13: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12;

%e 14: 1, 3, 4, 5, 9, 11, 12, 13;

%e 15: 1, 2, 4, 7, 8, 9, 11, 13, 14;

%t irelprime[ n_ ] := Select[ temp=iDivisors[ n ]; Range[ n ], Intersection[ iDivisors[ # ], temp ]==={1}& ]; (* with iDivisors of n as *) bitty[ k_ ] := Union[ Flatten[ Outer[ Plus, Sequence@@{0, #1}&/@Union[ 2^Range[ 0, Floor[ Log[ 2, k ] ] ]*Reverse[ IntegerDigits[ k, 2 ] ] ] ] ] ]; iDivisors[ k_Integer ] := Sort[ (Times @@(First[ it ]^(#1/.z-> List))&)/@Flatten[ Outer[ z, Sequence@@bitty/@Last[ it=Transpose[ FactorInteger[ k ] ] ], 1 ] ] ]; iDivisors[ 1 ] := {1};

%t infCoprimeQ[n1_, n2_] := Module[{g = GCD[n1, n2]}, If[g == 1, True, AllTrue[ FactorInteger[g][[;; , 1]], BitAnd @@ IntegerExponent[{n1, n2}, #] == 0 &]]]; row[n_] := Select[Range[n - 1], infCoprimeQ[#, n] &]; Table[row[n], {n, 2, 16}] // Flatten (* _Amiram Eldar_, Mar 26 2023 *)

%o (PARI) isinfcoprime(n1, n2) = {my(g = gcd(n1, n2), p, e1, e2); if(g == 1,return(1)); p = factor(g)[, 1]; for(i=1, #p, e1 = valuation(n1, p[i]); e2 = valuation(n2, p[i]); if(bitand(e1, e2) > 0, return(0))); 1; }

%o row(n) = select(x->isinfcoprime(x, n), vector(n-1, i, i)); \\ _Amiram Eldar_, Mar 26 2023

%Y Cf. A037445, A064380.

%K nonn,tabf

%O 2,3

%A _Wouter Meeussen_, Sep 27 2001