Bresenham's algorithm minimizes error in drawing lines on integer grid points; leap year calculations, surprisingly, are a generalization. We compare the two calculations, explicate the pattern, and discuss the connection of the leap year/line pattern with integer division and Euclid's algorithm for computing the greatest common divisor. Categories and Subject Descriptors: F.2.1 [Analysis of Algorithms and Problem Complexity]: Numerical Algorithms and Problems--Number-theoretic computations (e.g., factoring, primality testing); I.3.3 [Computer Graphics]: Picture/Image Generation; J.2 [Physical Sciences and Engineering]: Astronomy; Mathematics and statistics General Terms: Algorithms, Theory Additional Key Words and Phrases: Bresenham's algorithm, calendar algorithms, continued fractions, Euclid's algorithm, greatest common divisor, leap years, line drawing, scan-line conversion
Mitchell A. Harris, Edward M. Reingold