Пример #1
0
def main():
    numero = raw_input("Digite um numero em binario:")
    lista = burro.fatoracao_burra(numero)
    colecao = list(set(lista))
    for i in colecao:
        num = str(bin(i))
        print num[2:], lista.count(i)
    
    #print de debug
    print lista
Пример #2
0
if __name__ == "__main__":
    tamanhos = (5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)  # o correto eh (15,20,25,30,35,40,45,50)
    respostas = []
    x_list1 = list(tamanhos)
    y_list1 = []
    x_list2 = list(tamanhos)
    y_list2 = []
    for tamanho in tamanhos:
        tempo_inicio = os.times()[0]
        # print tempo_inicio
        teste = produz_teste(tamanho)
        res = []
        tempos = []
        fatores_primos = 0
        for numero in teste:
            fat = burro.fatoracao_burra(numero)
            res.append(fat)
            tempo_teste = os.times()[0] - tempo_inicio
            tempo_inicio = os.times()[0]
            tempos.append(tempo_teste)
            fatores_primos = fatores_primos + len(fat)
        y_list1.append(sum(tempos) / NUM_TESTES)
        y_list2.append((1.0 * fatores_primos) / NUM_TESTES)

    print x_list1
    print y_list1
    faz_graficos(x_list1, y_list1, "m", "Tempo Medio", "1")

    print x_list2
    print y_list2
    faz_graficos(x_list2, y_list2, "m", "Numero Medio de Fatores Primos", "2")