Enter a number to check if it's a Pell number, or input N to calculate the Nth Pell number and its cumulative sum.
Pell numbers are a specific sequence of numbers defined by the following recurrence relation:
Solution:
Generate Pell Numbers:
\( P_0 = 0 \)
\( P_1 = 1 \)
\( P_2 = 2P_1 + P_0 = 2 \times 1 + 0 = 2 \)
\( P_3 = 2P_2 + P_1 = 2 \times 2 + 1 = 5 \)
\( P_4 = 2P_3 + P_2 = 2 \times 5 + 2 = 12 \)
Result:
6 is not a Pell number because it does not appear in the sequence.
Solution:
Generate Pell Numbers:
\( P_0 = 0 \)
\( P_1 = 1 \)
\( P_2 = 2P_1 + P_0 = 2 \times 1 + 0 = 2 \)
\( P_3 = 2P_2 + P_1 = 2 \times 2 + 1 = 5 \)
\( P_4 = 2P_3 + P_2 = 2 \times 5 + 2 = 12 \)
\( P_5 = 2P_4 + P_3 = 2 \times 12 + 5 = 29 \)
\( P_6 = 2P_5 + P_4 = 2 \times 29 + 12 = 70 \)
Result:
70 is a Pell number.
Solution:
Generate Pell Numbers:
\( P_0 = 0 \)
\( P_1 = 1 \)
\( P_2 = 2P_1 + P_0 = 2 \times 1 + 0 = 2 \)
\( P_3 = 2P_2 + P_1 = 2 \times 2 + 1 = 5 \)
\( P_4 = 2P_3 + P_2 = 2 \times 5 + 2 = 12 \)
\( P_5 = 2P_4 + P_3 = 2 \times 12 + 5 = 29 \)
\( P_6 = 2P_5 + P_4 = 2 \times 29 + 12 = 70 \)
\( P_7 = 2P_6 + P_5 = 2 \times 70 + 29 = 169 \)
\( P_8 = 2P_7 + P_6 = 2 \times 169 + 70 = 408 \)
Result:
The 8th Pell number is 408, and the cumulative sum is 696.