[프로그래머스] 소수 만들기 문제 풀이



1. 문제

https://programmers.co.kr/learn/courses/30/lessons/12977

2. 풀이

import math
from itertools import combinations

def is_sosu(number):
    for i in range(2, int(math.sqrt(number))+1):
        if number % i == 0:
            return False
    return True

def solution(nums):
    answer = 0
    for x in list(combinations(nums, 3)):
        if is_sosu(sum(x)):
            answer += 1
    return answer