Malcolm writes a positive integer on a piece of paper. Malcolm doubles this integer and subtracts 1, writing this second result on the same piece of paper. Malcolm then doubles the second integer and adds 1, writing this third integer on the paper. If all of the numbers Malcolm writes down are prime, determine all possible values for the first integer.
1. Let the first integer be \( n \). According to the problem, Malcolm performs the following operations:
   - Doubles the integer and subtracts 1: \( 2n - 1 \)
   - Doubles the result of the previous operation and adds 1: \( 2(2n - 1) + 1 = 4n - 1 \)

2. We are given that all three numbers \( n \), \( 2n - 1 \), and \( 4n - 1 \) are prime numbers. We need to determine all possible values of \( n \).

3. Since \( n \) is a prime number, we consider the possible forms of prime numbers:
   - \( n = 2 \)
   - \( n = 3 \)
   - \( n = 6k + 1 \) for some integer \( k \)
   - \( n = 6k - 1 \) for some integer \( k \)

4. Check \( n = 2 \):
   - \( 2n - 1 = 2(2) - 1 = 3 \) (which is prime)
   - \( 4n - 1 = 4(2) - 1 = 7 \) (which is prime)
   - Therefore, \( n = 2 \) is a valid solution.

5. Check \( n = 3 \):
   - \( 2n - 1 = 2(3) - 1 = 5 \) (which is prime)
   - \( 4n - 1 = 4(3) - 1 = 11 \) (which is prime)
   - Therefore, \( n = 3 \) is a valid solution.

6. Check \( n = 6k + 1 \):
   - \( 2n - 1 = 2(6k + 1) - 1 = 12k + 1 \)
   - \( 4n - 1 = 4(6k + 1) - 1 = 24k + 3 \)
   - For \( 2n - 1 \) and \( 4n - 1 \) to be prime, \( 12k + 1 \) and \( 24k + 3 \) must be prime. However, for \( k \geq 1 \), \( 24k + 3 \) is always divisible by 3 and greater than 3, hence not prime. Therefore, \( n = 6k + 1 \) does not yield any valid solutions.

7. Check \( n = 6k - 1 \):
   - \( 2n - 1 = 2(6k - 1) - 1 = 12k - 3 \)
   - \( 4n - 1 = 4(6k - 1) - 1 = 24k - 5 \)
   - For \( 2n - 1 \) and \( 4n - 1 \) to be prime, \( 12k - 3 \) and \( 24k - 5 \) must be prime. However, for \( k \geq 1 \), \( 12k - 3 \) is always divisible by 3 and greater than 3, hence not prime. Therefore, \( n = 6k - 1 \) does not yield any valid solutions.

Conclusion:
The only possible values for \( n \) that satisfy the conditions are \( n = 2 \) and \( n = 3 \).

The final answer is \( \boxed{2 \text{ and } 3} \).