コード例 #1
0
def test_small_21():
    time.sleep(2)
    assert isPrime(21) == True
コード例 #2
0
def test_small_1():
    assert isPrime(1) == True
コード例 #3
0
ファイル: problem35.py プロジェクト: homo-iocus/Project-Euler
def checkCircPrime(n: list) -> bool:
    for nums in n:
        if not isPrime(nums):
            return False
    return True
コード例 #4
0
def test_small_negative():
    assert isPrime(-7) == True
コード例 #5
0
def test_small_0():
    assert isPrime(0) == False
コード例 #6
0
def test_small_2():
    #time.sleep(2)
    assert isPrime(2) == True
コード例 #7
0
def test_small_1():
    assert isPrime(1) == False
コード例 #8
0
def test_small_21():
    assert isPrime(21) == False
コード例 #9
0
def test_small_big():
    assert isPrime(87178291199) == True
コード例 #10
0
ファイル: problem37.py プロジェクト: homo-iocus/Project-Euler
        if not new_numb1 == "":
            new_numbers.append(new_numb1)
        if not new_numb2 == "":
            new_numbers.append(new_numb2)
    return new_numbers


#check if all numbers in a list are primes.
def isAllPrime(j: list):
    for numb in j:
        if not isPrime(int(numb)):
            return False
    return True


print(isPrime(0))

sum = 0
found = 0
for i in range(10, 1000000):
    print("checking for {}".format(i))
    numbs = pieceOfNumb(str(i))
    if isAllPrime(numbs):
        sum = sum + i
        found = found + 1
    #if we have found 11 numbers we can exit the loop
    if found == 11:
        break

#Print Solution out
コード例 #11
0
ファイル: problem37.py プロジェクト: homo-iocus/Project-Euler
def isAllPrime(j: list):
    for numb in j:
        if not isPrime(int(numb)):
            return False
    return True
コード例 #12
0
def test_small_3():
    assert isPrime(3) == True
コード例 #13
0
def test_small_2():
    assert isPrime(2) == True
コード例 #14
0
'''
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10 001st prime number?
'''

import time
from Prime import isPrime

count = int(
    input(
        "Enter the position of prime number you want to generate(1st, 1000th etc): "
    ))

start = time.time()

j = 0
n = 0
while (j <= count):
    n += 1
    if (isPrime(n)):
        j += 1

print("The {0}th Prime Number is {1}".format(count, n))

end = time.time()
print("Executed in {0:5f} ms".format((end - start) * 1000))
コード例 #15
0
def test_small_2():
    time.sleep(2)
    assert isPrime(2) == False
コード例 #16
0
def test_small_big_false():
    assert isPrime(87178291197) == False
コード例 #17
0
def test_small_3():
    time.sleep(2)
    assert isPrime(3) == True
コード例 #18
0
def test_small_21():
    #time.sleep(2)
    assert isPrime(21) == False