Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def fib(x):
- a = 1
- b = 1
- j = 0
- if x == 1:
- return a
- elif x == 2:
- return b
- else:
- while x >= j + 1:
- c = a+b
- a=b
- b=c
- if is_prime(c):
- print(c)
- j += 1
- def is_prime(num):
- if num > 1:
- for i in range(2,num):
- if (num % i) == 0:
- return False
- else:
- return True
- fib(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement