A112593 Triangle where a(1,1) = 1, a(n,m) = number of terms of row (n-1) which are coprime to m. Row n has (2n-1) terms.
1, 1, 1, 1, 3, 3, 3, 3, 3, 5, 5, 0, 5, 5, 0, 5, 7, 5, 5, 5, 0, 5, 5, 5, 5, 9, 8, 8, 8, 1, 8, 7, 8, 8, 1, 8, 11, 4, 10, 4, 11, 3, 10, 4, 10, 4, 11, 3, 11, 13, 6, 11, 6, 10, 4, 13, 6, 11, 6, 9, 4, 13, 6, 8, 15, 6, 9, 6, 14, 5, 15, 6, 9, 6, 13, 5, 12, 6, 8, 6, 15, 17, 8, 5, 8, 12, 3, 16, 8, 5, 3, 17, 3, 16
Offset: 1
Examples
Row 5 of the triangle is [7,5,5,5,0,5,5,5,5]. Among these terms there are 9 terms coprime to 1, 8 terms coprime to 2, 8 terms coprime to 3, 8 terms coprime to 4, 1 term coprime to 5, 8 terms coprime to 6, 7 terms coprime to 7, 8 terms coprime to 8, 8 terms coprime to 9, 1 term coprime to 10 and 8 terms coprime to 11. So row 6 is [9,8,8,8,1,8,7,8,8,1,8]. Table begins: 1, 1,1,1, 3,3,3,3,3, 5,5,0,5,5,0,5, 7,5,5,5,0,5,5,5,5, 9,8,8,8,1,8,7,8,8,1,8, 11,4,10,4,11,3,10,4,10,4,11,3,11, 13,6,11,6,10,4,13,6,11,6,9,4,13,6,8, 15,6,9,6,14,5,15,6,9,6,13,5,12,6,8,6,15, 17,8,5,8,12,3,16,8,5,3,17,3,16,8,3,8,17,3,17
Crossrefs
Cf. A112599.
Row sums are in A160991. [From Klaus Brockhaus, Jun 01 2009]
Programs
-
Mathematica
f[l_] := Append[l, Table[ Count[GCD[Last[l], n], 1], {n, Length[Last[l]] + 2}]]; Flatten[Nest[f, {{1}}, 9]] (* Ray Chandler, Jan 02 2006 *) t[1, 1] = 1; t[n_, m_] := t[n, m] = Count[ GCD[ Table[ t[n - 1, k], {k, 2n - 3}], m], 1]; Table[ t[n, m], {n, 10}, {m, 2n - 1}] // Flatten (* Robert G. Wilson v *)
-
PARI
{print1(s=1,",");v=[s];for(i=2,10,w=vector(2*i-1);for(j=1,2*i-1,c=0;for(k=1,2*i-3,if(gcd(v[k],j)==1,c++));print1(w[j]=c,","));v=w)} (Brockhaus)
Comments