Skip to main content

质数处理和寻找质数的模块

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyunit-prime, version 2020.3.22
Filename, size File type Python version Upload date Hashes
Filename, size pyunit_prime-2020.3.22.tar.gz (38.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page