Example #1
0
def prime_factors(number):
    """Calculate the prime factors of a number

    Calculate the prime factors of a given natural NUMBER. Note that 1 is
    not a prime number, so it will not be included.
    """
    result = pm.prime_factors(int(number))
    click.echo(result)
Example #2
0
def test_prime_factors_one():
    expect = []
    result = pm.prime_factors(1)
    assert result == expect
Example #3
0
def test_prime_factors_large():
    expect = [11, 9539, 894119]
    result = pm.prime_factors(93819012551)
    assert result == expect
Example #4
0
def test_prime_factors_mixed():
    expect = [5, 17, 23, 461]
    result = pm.prime_factors(901255)
    assert result == expect
Example #5
0
def test_prime_factors_cube():
    expect = [3, 3, 3]
    result = pm.prime_factors(27)
    assert result == expect
Example #6
0
def test_prime_factors_square():
    expect = [3, 3]
    result = pm.prime_factors(9)
    assert result == expect