Untitled

mail@pastecode.io avatar
unknown
python
7 months ago
429 B
0
Indexable
Never
# Read the number of terms N
N = int(input().strip())

# Initialize the first term
tn = 1

# Initialize an empty list to store the terms
terms = []

# Loop through the sequence to generate N terms
for n in range(1, N + 1):
    terms.append(str(tn))
    tn += n + 1  # Update the term based on the previous one

# Convert the list of terms to a single string separated by space and print it
print(" ".join(terms))