# IAL-501 (Prof. Dr. Silvio do Lago Pereira)

from util import *

#-----------------------------------------------------------
# Exercicio 4
#-----------------------------------------------------------

def then(p,q): return (not p or q)

#-----------------------------------------------------------
# Exemplo 6
#-----------------------------------------------------------

def p(x): return x % 2 == 0

D = [2,4,6]

#-----------------------------------------------------------
# Exemplo 8
#-----------------------------------------------------------

def Si(n): 
    if n==1: return 1 
    else:    return Si(n-1) + (2*n-1)

#-----------------------------------------------------------
# Exercicio 9
#-----------------------------------------------------------

def Sn(n): 
    if n==1: return 1 
    else:    return Sn(n-1) + n

#-----------------------------------------------------------
# Exercicio 11
#-----------------------------------------------------------

def Sp(n): 
    if n==1: return 1 
    else:    return Sp(n-1) + 2**(n-1)
