a.) There are $2n+1$ ($n>2$) batteries. We don't know which batteries are good and which are bad but we know that the number of good batteries is greater by $1$ than the number of bad batteries. A lamp uses two batteries, and it works only if both of them are good. What is the least number of attempts sufficient to make the lamp work?

b.) The same problem but the total number of batteries is $2n$ ($n>2$) and the numbers of good and bad batteries are equal.

[i]Proposed by Alexander Shapovalov[/i] 
### Part (a): \(2n+1\) Batteries

1. **Understanding the Problem:**
   - We have \(2n+1\) batteries.
   - The number of good batteries is \(n+1\).
   - The number of bad batteries is \(n\).
   - We need to find the minimum number of attempts to ensure the lamp works, which means finding two good batteries.

2. **Strategy:**
   - We need to test pairs of batteries.
   - The worst-case scenario is that we test all pairs of batteries until we find a pair of good ones.

3. **Calculating the Minimum Number of Attempts:**
   - In the worst case, we might test all pairs of batteries except the last pair of good batteries.
   - The number of ways to choose 2 batteries out of \(2n+1\) is given by the binomial coefficient \(\binom{2n+1}{2}\).

4. **Using the Pigeonhole Principle:**
   - Since there are \(n+1\) good batteries, we need to ensure that we test at least one pair of good batteries.
   - The minimum number of attempts required is when we have tested all possible pairs of batteries except the last pair of good batteries.

5. **Conclusion:**
   - The least number of attempts sufficient to make the lamp work is \(\boxed{n+1}\).

### Part (b): \(2n\) Batteries

1. **Understanding the Problem:**
   - We have \(2n\) batteries.
   - The number of good batteries is \(n\).
   - The number of bad batteries is \(n\).
   - We need to find the minimum number of attempts to ensure the lamp works, which means finding two good batteries.

2. **Strategy:**
   - We need to test pairs of batteries.
   - The worst-case scenario is that we test all pairs of batteries until we find a pair of good ones.

3. **Calculating the Minimum Number of Attempts:**
   - In the worst case, we might test all pairs of batteries except the last pair of good batteries.
   - The number of ways to choose 2 batteries out of \(2n\) is given by the binomial coefficient \(\binom{2n}{2}\).

4. **Using the Pigeonhole Principle:**
   - Since there are \(n\) good batteries, we need to ensure that we test at least one pair of good batteries.
   - The minimum number of attempts required is when we have tested all possible pairs of batteries except the last pair of good batteries.

5. **Conclusion:**
   - The least number of attempts sufficient to make the lamp work is \(\boxed{n}\).