Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Mon Dec 10 19:42:53 2018
- @author: pytlpawe
- """
- import math
- lista = [5, 7, 4, 18, 3, 7, 5, 1, 2, 12, 7, 13]
- podejrzane = []
- def LiczbyPierwsze (lista):
- for i in range (len(lista)):
- if (lista[i] < 2):
- podejrzane.append (lista[i])
- elif (lista[i] > 2):
- Prime = 1
- for j in range (2, int(math.sqrt(lista[i]))+1):
- if (lista[i]%j == 0):
- Prime = 0
- break
- if Prime == 1:
- podejrzane.append (lista[i])
- def wyst_np (lista, podejrzane):
- for i in range (len(lista))
- # -*- coding: utf-8 -*-
- """
- Created on Mon Dec 10 19:21:30 2018
- @author: pytlpawe
- """
- import time
- wartosci = []
- def tab (n):
- for i in range (n+1):
- wartosci.append (-1)
- def fibo (n):
- if (wartosci [n] != -1):
- return wartosci [n]
- else:
- if n==0:
- wartosci [n] = 0
- return wartosci [n]
- elif n==1:
- wartosci [n] = 1
- return wartosci [n]
- elif n>1:
- wartosci [n] = fibo (n-1) + fibo (n-2)
- return wartosci [n]
- def function (n):
- tab (n)
- return fibo (n)
- start_r = time.time()
- liczba = function (14)
- print (liczba)
- print ("Obliczenie zajelo", time.time() - start_r)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement