0 out of 464 challenges solved

Sum of Even Index Binomial Coefficients

Write a Python function `even_binomial_coeff_sum(n)` that takes a positive integer `n` and returns the sum of the binomial coefficients at even indices in the expansion of `(x + y)^n`.

The binomial coefficients for `(x + y)^n` are given by:

\[
C(n, k) = \frac{n!}{k! (n-k)!}
\]

where `k` ranges from `0` to `n`. For this problem, you need to sum the coefficients where `k` is even.

#### Example Usage
```python [main.nopy]
print(even_binomial_coeff_sum(4))  # Output: 8
print(even_binomial_coeff_sum(6))  # Output: 32
print(even_binomial_coeff_sum(2))  # Output: 2
```

#### Constraints
- `n` is a positive integer.
- The function should be efficient and handle values of `n` up to 20.
def even_binomial_coeff_sum(n):
    """
    Calculate the sum of binomial coefficients at even indices for (x + y)^n.

    Args:
    n (int): A positive integer.

    Returns:
    int: The sum of the binomial coefficients at even indices.
    """
    # Placeholder for the solution
    pass