login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A109004
Table of gcd(n,m) read by antidiagonals, n >= 0, m >= 0.
25
0, 1, 1, 2, 1, 2, 3, 1, 1, 3, 4, 1, 2, 1, 4, 5, 1, 1, 1, 1, 5, 6, 1, 2, 3, 2, 1, 6, 7, 1, 1, 1, 1, 1, 1, 7, 8, 1, 2, 1, 4, 1, 2, 1, 8, 9, 1, 1, 3, 1, 1, 3, 1, 1, 9, 10, 1, 2, 1, 2, 5, 2, 1, 2, 1, 10, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 12, 1, 2, 3, 4, 1, 6, 1, 4, 3, 2, 1, 12, 13, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 13
OFFSET
0,4
REFERENCES
L. E. Dickson, History of the Theory of Numbers. Carnegie Institute Public. 256, Washington, DC, Vol. 1, 1919; Vol. 2, 1920; Vol. 3, 1923, see vol. 1, p. 335.
R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics, Addison-Wesley, 2nd ed., 1994, ch. 4.
D. E. Knuth, The Art of Computer Programming, Addison-Wesley, section 4. 5. 2
LINKS
Marcelo Polezzi, A Geometrical Method for Finding an Explicit Formula for the Greatest Common Divisor, The American Mathematical Monthly, Vol. 104, No. 5 (May, 1997), pp. 445-446.
FORMULA
a(n, m) = a(m, n) = a(m, n-m) = a(m, n mod m), n >= m.
a(n, m) = n + m - n*m + 2*Sum_{k=1..m-1} floor(k*n/m).
Multiplicative in both parameters with a(p^e, m) = gcd(p^e, m). - David W. Wilson, Jun 12 2005
EXAMPLE
0;
1, 1;
2, 1, 2;
3, 1, 1, 3;
4, 1, 2, 1, 4;
5, 1, 1, 1, 1, 5;
6, 1, 2, 3, 2, 1, 6;
...
MATHEMATICA
a[n_, m_] := GCD[n, m]; Table[a[n - m, m], {n, 0, 10}, {m, 0, n}]//Flatten (* G. C. Greubel, Jan 04 2018 *)
PROG
(PARI) {a(n, m) = gcd( n, m)}
(PARI) {a(n, m) = local(x); n = abs(n); m = abs(m); if( !m, n, -2 * sum( k=1, m, x = k * n / m; x - floor( x) - 1/2))} /* Michael Somos, May 22 2011 */
CROSSREFS
Rows, columns and diagonals: A089128, A109007, A109008, A109009, A109010, A109011, A109012, A109013, A109014, A109015.
A003989 is (1, 1) based.
Sequence in context: A137152 A328902 A159335 * A103823 A355246 A136642
KEYWORD
nonn,easy,mult,tabl
AUTHOR
STATUS
approved