kyu_5.master_your_primes_sieve_with_memoization package

Submodules

kyu_5.master_your_primes_sieve_with_memoization.primes module

Solution for -> Master your primes: sieve with memoization.

Created by Egor Kostan. GitHub: https://github.com/ikostan

kyu_5.master_your_primes_sieve_with_memoization.primes.is_prime(digit: int) bool[source]

is_prime function.

A function that checks if a given number ‘digit’ is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each ‘digit’, stop}. :param digit: int :return: bool

kyu_5.master_your_primes_sieve_with_memoization.test_primes module

Test for -> Master your primes: sieve with memoization.

Created by Egor Kostan. GitHub: https://github.com/ikostan

class kyu_5.master_your_primes_sieve_with_memoization.test_primes.PrimesTestCase(methodName='runTest')[source]

Bases: TestCase

Testing is_prime function.

_classSetupFailed = False
_class_cleanups = []
test_is_primes = None
test_is_primes_00(**kw)

Testing is_prime function with various test data [with number=1, expected=False].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_01(**kw)

Testing is_prime function with various test data [with number=2, expected=True].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_02(**kw)

Testing is_prime function with various test data [with number=5, expected=True].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_03(**kw)

Testing is_prime function with various test data [with number=143, expected=False].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_04(**kw)

Testing is_prime function with various test data [with number=-1, expected=False].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_05(**kw)

Testing is_prime function with various test data [with number=29, expected=True].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_06(**kw)

Testing is_prime function with various test data [with number=53, expected=True].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_07(**kw)

Testing is_prime function with various test data [with number=529, expected=False].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_08(**kw)

Testing is_prime function with various test data [with number=4539131, expected=True].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_09(**kw)

Testing is_prime function with various test data [with number=110268984695, expected=False].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_10(**kw)

Testing is_prime function with various test data [with number=97444114757, expected=False].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_11(**kw)

Testing is_prime function with various test data [with number=7301162915, expected=False].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_12(**kw)

Testing is_prime function with various test data [with number=8033908462571, expected=False].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_13(**kw)

Testing is_prime function with various test data [with number=8813991225347, expected=False].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_14(**kw)

Testing is_prime function with various test data [with number=857561895605, expected=False].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_15(**kw)

Testing is_prime function with various test data [with number=13, expected=True].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_16(**kw)

Testing is_prime function with various test data [with number=17, expected=True].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_17(**kw)

Testing is_prime function with various test data [with number=19, expected=True].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_18(**kw)

Testing is_prime function with various test data [with number=23, expected=True].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

test_is_primes_19(**kw)

Testing is_prime function with various test data [with number=29, expected=True].

Testing a function that checks if a given number n is a prime looping through it and, possibly, expanding the array/list of known primes only if/when necessary (ie: as soon as you check for a potential prime which is greater than a given threshold for each n, stop).

Returns:

Module contents

Master your primes: sieve with memoization.