Question 1177294
You're right, let's break down why this discrete random variable X has an infinite expected value.

**Understanding the Problem**

* We're given a discrete random variable X.
* The possible values of X are 2^n, where n = 1, 2, 3, ... (i.e., 2, 4, 8, 16, ...).
* The probability of X taking the value 2^n is P(X = 2^n) = 1 / 2^n.
* We need to show that the expected value E(X) is infinite.

**Calculating the Expected Value**

The expected value of a discrete random variable is calculated as:

* E(X) = Σ [x * P(X = x)]

In our case:

* E(X) = Σ [2^n * (1 / 2^n)]  for n = 1, 2, 3, ...

**Simplifying the Expression**

* E(X) = Σ [2^n / 2^n]
* E(X) = Σ [1]  for n = 1, 2, 3, ...

**Analyzing the Sum**

This means:

* E(X) = 1 + 1 + 1 + 1 + ... (an infinite sum of 1s)

**Conclusion**

Since we are adding 1 infinitely many times, the sum diverges to infinity.

* E(X) = ∞

**Therefore, the expected value of X is infinite, meaning X has no mathematical expectation.**

**Regarding the Code and its output**

The provided code calculates the partial sum of the series, not the correct expected value. The code calculates the partial sum of Σ n * (2^(n-1)) / (2^n) and not Σ 2^n * (1/2^n). The correct expected value calculation, as shown above, results in an infinite sum.