```python
def gcd(p, q):
    """
    Checks if two numbers, p and q, are co-prime.

    Two numbers are co-prime if their greatest common divisor (GCD) is 1.
    This function calculates the GCD using the Euclidean algorithm and then
    checks if it is equal to 1.
    """
    # Use the Euclidean algorithm to find the greatest common divisor
    while q:
        p, q = q, p % q
    
    # If the greatest common divisor is 1, the numbers are co-prime.
    return p == 1

```