Let $S$ be the set of positive integers $x$ for which there exist positive integers $y$ and $m$ such that $y^2-2^m=x^2$.

(a) Find all of the elements of $S$.
(b) Find all $x$ such that both $x$ and $x+1$ are in $S$.
Given the equation \( y^2 - 2^m = x^2 \), we can rewrite it as:
\[ y^2 - x^2 = 2^m \]
This can be factored using the difference of squares:
\[ (y - x)(y + x) = 2^m \]

1. **Factorization and Analysis:**

   Since \( y \) and \( x \) are positive integers, both \( y - x \) and \( y + x \) must be positive integers. Also, since \( 2^m \) is a power of 2, both \( y - x \) and \( y + x \) must be powers of 2. Let:
   \[ y - x = 2^a \]
   \[ y + x = 2^b \]
   where \( a \) and \( b \) are non-negative integers and \( a < b \).

2. **Solving for \( y \) and \( x \):**

   Adding and subtracting these equations, we get:
   \[ 2y = 2^a + 2^b \]
   \[ 2x = 2^b - 2^a \]
   Therefore:
   \[ y = 2^{a-1} + 2^{b-1} \]
   \[ x = 2^{b-1} - 2^{a-1} \]

3. **Conditions on \( a \) and \( b \):**

   Since \( x \) must be a positive integer, \( 2^{b-1} > 2^{a-1} \), which implies \( b > a \).

4. **Finding all elements of \( S \):**

   We need to find all pairs \((a, b)\) such that \( b > a \) and both \( y \) and \( x \) are positive integers. Let's consider the smallest values of \( a \) and \( b \):

   - For \( a = 0 \) and \( b = 1 \):
     \[ y = 2^{-1} + 2^{0} = \frac{1}{2} + 1 \] (not an integer, discard)
   - For \( a = 1 \) and \( b = 2 \):
     \[ y = 2^{0} + 2^{1} = 1 + 2 = 3 \]
     \[ x = 2^{1} - 2^{0} = 2 - 1 = 1 \]
     So, \( x = 1 \) is in \( S \).

   - For \( a = 1 \) and \( b = 3 \):
     \[ y = 2^{0} + 2^{2} = 1 + 4 = 5 \]
     \[ x = 2^{2} - 2^{0} = 4 - 1 = 3 \]
     So, \( x = 3 \) is in \( S \).

   - For \( a = 2 \) and \( b = 3 \):
     \[ y = 2^{1} + 2^{2} = 2 + 4 = 6 \]
     \[ x = 2^{2} - 2^{1} = 4 - 2 = 2 \]
     So, \( x = 2 \) is in \( S \).

   - For \( a = 2 \) and \( b = 4 \):
     \[ y = 2^{1} + 2^{3} = 2 + 8 = 10 \]
     \[ x = 2^{3} - 2^{1} = 8 - 2 = 6 \]
     So, \( x = 6 \) is in \( S \).

   Continuing this process, we can find more elements of \( S \).

5. **Finding \( x \) such that both \( x \) and \( x+1 \) are in \( S \):**

   We need to find \( x \) such that both \( x \) and \( x+1 \) satisfy the equation \( y^2 - 2^m = x^2 \). From the previous analysis, we see that \( x \) and \( x+1 \) must both be expressible in the form \( 2^{b-1} - 2^{a-1} \).

   - For \( x = 1 \), \( x+1 = 2 \), both are in \( S \).
   - For \( x = 2 \), \( x+1 = 3 \), both are in \( S \).

   Therefore, the only \( x \) such that both \( x \) and \( x+1 \) are in \( S \) are \( x = 1 \) and \( x = 2 \).

The final answer is \( \boxed{ x = 1 } \) and \( x = 2 \).