Created
May 5, 2020 13:32
-
-
Save inspirit941/002569cc602a172a27efda53587f43f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import combinations | |
import math | |
def solution(nums): | |
candidates = combinations(nums, 3) | |
answer = 0 | |
for item in candidates: | |
sums = sum(item) | |
is_prime = True | |
for i in range(2, int(math.sqrt(sums)) + 1): | |
if sums % i == 0: | |
is_prime = False | |
break | |
if is_prime: | |
answer += 1 | |
return answer | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment