质数处理和寻找质数的模块
Project description
pyUnit-Prime
质数处理和寻找质数的模块
安装
pip install pyunit-prime
命令行运行:打开控制台
prime -h # 获取帮助
命令行:
判断是否是质数: prime -P 13
寻找一个超大质数: prime -L 100
返回区间内的质数: prime -R 100,500
判断是否是质数
from pyunit_prime import is_prime
if __name__ == '__main__':
for i in range(10_0000):
if is_prime(i):
print(i)
寻找一个超大质数
from pyunit_prime import get_large_prime
if __name__ == '__main__':
print(get_large_prime(150)) # 返回长度位150位的质数
返回区间内的质数
from pyunit_prime import prime_range
if __name__ == '__main__':
print(prime_range(100, 10000)) # 返回100到10000区间的质数
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyunit_prime-2020.3.22.tar.gz
(38.6 kB
view hashes)