Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import Counter
- from math import sqrt
- def is_prime(n):
- if n == 2:
- return True
- elif n < 2 or n % 2 == 0:
- return False
- k = 3
- while k <= int(sqrt(n)):
- if n % k == 0:
- return False
- k += 2
- return True
- def fun(A, B):
- counter = Counter()
- for b in B:
- counter[b] += 1
- C = []
- for a in A:
- # if a was not in B counter[a]=0
- if not is_prime(counter[a]):
- C.append(a)
- return C
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement