PYTHON PROGRAM
# Get the value of a and n from the user
a = float(input("Enter the value of a: "))
n = int(input("Enter the value of n: "))
# Calculate the sum of the series
if a == 1:
total_sum = n + 1
else:
total_sum = (a**(n + 1) - 1) / (a - 1)
# Print the sum of the series
print("The sum of the series is:", total_sum)
OUTPUT
Enter the value of a: 2
Enter the value of n: 2
The sum of the series is: 7.0
=== Code Execution Successful ===
--------------------------------------------------------------------------------------------------------------------------------------