This Python program displays the first 15 terms of a recursive sequence defined as:
F(1) = 2
F(n) = n × F(n - 1) for n > 1
It behaves like a factorial sequence but starts from 2 instead of 1.
def F(n: int) -> int:
if n == 1:
return 2
return n * F(n - 1)
# Display first 15 terms
print("First 15 terms of the sequence:")
for i in range(1, 16):
print(f"F({i}) = {F(i)}")
F(1) = 2
F(2) = 4
F(3) = 12
F(4) = 48
F(5) = 240
...