%I #27 Oct 12 2020 03:42:07
%S 1,2,2,3,2,3,4,4,4,4,5,4,3,4,5,6,6,6,6,6,6,7,6,7,4,7,6,7,8,8,6,8,8,6,
%T 8,8,9,8,9,8,5,8,9,8,9,10,10,10,10,10,10,10,10,10,10,11,10,9,8,11,6,
%U 11,8,9,10,11,12,12,12,12,12,12,12,12,12,12,12,12
%N Number of (interiors of) cells touched by a diagonal in a regular m X n grid (enumerated antidiagonally).
%H Nathaniel Johnston, <a href="/A074712/b074712.txt">First 150 antidiagonals, flattened</a>
%H Micky Bullock, <a href="http://www.mickybullock.com/blog/2010/06/the-diagonal-problem/">The Diagonal Problem (2 dimensions)</a>.
%H Alberto L. Delgado's <a href="https://web.archive.org/web/20080808134752/http://hilltop.bradley.edu/~delgado/potw/p145.html">Problem of the Week No. 145</a>.
%F T(m, n) = m + n - 1 if m and n are coprime; T(m, n) = d * T(m/d, n/d) where d is the greatest common divisor of m and n, otherwise.
%F T(m, n) = m + n - gcd(m, n). - _Luc Rousseau_, Sep 15 2017
%e The array begins:
%e 1 2 3 4 5 6 7 8
%e 2 2 4 4 6 6 8 8
%e 3 4 3 6 7 6 9 10
%e 4 4 6 4 8 8 10 8
%e 5 6 7 8 5 10 11 12
%e 6 6 6 8 10 6 12 12
%e 7 8 9 10 11 12 7 14
%e 8 8 10 8 12 12 14 8
%e ...
%p A074712 := proc(m,n) local d: d:=gcd(m,n): if(d=1)then return m+n-1: else return d*procname(m/d,n/d): fi: end: seq(seq(A074712(n-d+1,d),d=1..n),n=1..8); # _Nathaniel Johnston_, May 09 2011
%t T[m_,n_]=m+n-GCD[m,n];Table[T[m,s-m],{s,2,10},{m,1,s-1}]//Flatten (* _Luc Rousseau_, Sep 16 2017 *)
%o (PARI) (T(m,n)=m+n-gcd(m,n));for(s=2,10,for(m=1,s-1,n=s-m;print1(T(m,n),", "))) \\ _Luc Rousseau_, Sep 16 2017
%Y Cf. A199408.
%K easy,nonn,tabl
%O 1,2
%A _Jens Voß_, Sep 04 2002