2022-10-14 22:03:25 +00:00
|
|
|
# This program generates 20 terms of a sequence by a recurrence relation.
|
2023-05-16 20:14:36 +00:00
|
|
|
Un = 100 # Un = each term of the sequence. Initially = U0
|
2023-01-30 16:48:43 +00:00
|
|
|
count = 0
|
2022-10-14 22:03:25 +00:00
|
|
|
while Un > 0:
|
|
|
|
print(round(Un, 4))
|
2023-05-16 20:14:36 +00:00
|
|
|
Un = 1.01*Un - 1.01 # Set Un to the next term of the sequence
|
2023-01-30 16:48:43 +00:00
|
|
|
count += 1
|
2022-10-14 22:03:25 +00:00
|
|
|
|
2023-01-30 16:48:43 +00:00
|
|
|
print('O programa mostrou ', count, ' termos')
|