gcd2n
gcd2n refers to the greatest common divisor of 2 and n, typically written as gcd(2, n). For integers n, gcd(2, n) is the largest positive integer that divides both 2 and n. Since the only positive divisors of 2 are 1 and 2, gcd(2, n) can only be 1 or 2. In particular, gcd(2, n) = 1 when n is odd, and gcd(2, n) = 2 when n is even. By convention gcd(2, 0) = 2, and gcd(2, n) = gcd(2, |n|). Therefore the parity of n completely determines gcd2n: it equals 2 if n is even, and 1 if n is odd.
The function is straightforward but useful in quick parity checks and in contexts where gcd with 2
Examples: gcd2n for n = 1 is 1; n = 2 is 2; n = 3 is 1; n = 0
See also gcd and parity; related concepts include lcm(2, n) and congruences modulo 2. The notation gcd2n