Data Structure & Algorithm: Level-1 Problem #1. Find Primes

Given a positive number, find out all the prime numbers under it.

Sample Input:

27

Sample Output:

There are 9 prime numbers under 27:
2, 3, 5, 7, 11, 13, 17, 19, 23


数据结构和算法:初级练习题#1 – 找质数


给定一个正整数,找出所有小于它的质数。

输入样例:

27

输出样例:

小于27的质数有9个:2, 3, 5, 7, 11, 13, 17, 19, 23


Python Solution

Count Primes