Sei sulla pagina 1di 5

RELACIONES DE RECURRENCIA

ACTIVADAD 1

𝑆(𝑛) = 1, 5, 14, 30, 55, … , 𝑛


Pase base o condicional inicial

𝑆(1) = 1
Paso recursivo

𝑆(2) = 5 = 𝑆(1) + 22 = 5

𝑆(3) = 14 = 𝑆(2) + 32 = (𝑆(1) + 22 ) + 32 = 14

= (1 + 22 ) + 32 = 14
𝑆(4) = 30 = 𝑆(3) + 42 = (𝑆(2) + 32 ) + 42

= ((𝑆(1) + 22 ) + 32 ) + 42 = 30

= 1 + 4 + 9 + 16 = 30

𝑆(𝑛) = 𝑆(𝑛 − 1)+ 𝑛2

ALGORITMO

Formulando un algoritmo

caso base

si n=1 , 1

Serie(n) =

caso recurrente

si n>1 , Serie(𝑛 − 1)+ 𝑛2

Algoritmo Serie()

Serie (n:entero): entero

inicio

si (n=1)

retornar 1

caso contrario
retornar Serie(𝑛 − 1)+ 𝑛2

fin

Codificación

Actividad 2

𝑆(𝑛) = 1, 3, 5,7,9, … , 𝑛
Pase base o condicional inicial

𝑆(1) = 1
Paso recursivo

𝑆(2) = 3 = 𝑆(1) + 2 = 3
𝑆(3) = 5 = 𝑆(2) + 2 = (𝑆(1) + 2) + 2 = 5
= (1 + 2) + 2 = 5
𝑆(4) = 7 = 𝑆(3) + 2 = (𝑆(2) + 2 ) + 2 = 7

((𝑆(1) + 2) + 2 ) + 4 = 7

𝑆(𝑛) = 𝑆(𝑛 − 1) + 2
ALGORITMO

Formulando un algoritmo

caso base

si n=1 , 1

Serie(n) =

caso recurrente

si n>1 , Serie(𝑛 − 1) + 2

Algoritmo Serie()

Serie (n:entero): entero

inicio

si (n=1)

retornar 1

caso contrario

retornar Serie(𝑛 − 1) + 2

fin

ACTIVIDAD 3
𝑆(𝑛) = 0, 1 , 3 , 1 , 4 , 4 , 5 , 8 ,9 , 13, … . , 𝑛
Pase base o condicional inicial

𝑆(1) = 0
𝑆(2) = 1
S (3) = 3

Paso recursivo

𝑆(4) = 𝑆(1) + 𝑆(2) = 1


𝑆(5) = 𝑆(2) + 𝑆(3 ) = 4
𝑆(6) = 𝑆(3 ) + 𝑆(4) = 4

𝑆(𝑛) = 𝑆(𝑛 − 3) + 𝑆(𝑛 − 2)

ALGORITMO

Formulando un algoritmo

caso base

si n=1 , 0

si n=2, 1

si n=3, 2

Serie(n) =

caso recurrente

si n>3 , Serie(𝑛 − 3) + (𝑛 − 2)

Algoritmo Serie()

Serie (n:entero): entero

inicio

si (n=1)

retornar 1

caso contrario

retornar Serie(𝑛 − 3) + (𝑛 − 2)
fin

Potrebbero piacerti anche