コード例 #1
0
def divisors_and_divisor_count():
    assert divisors(-1) == [1]
    assert divisors(0) == []
    assert divisors(1) == [1]
    assert divisors(2) == [1, 2]
    assert divisors(3) == [1, 3]
    assert divisors(10) == [1, 2, 5, 10]
    assert divisors(100) == [1, 2, 4, 5, 10, 20, 25, 50, 100]
    assert divisors(101) == [1, 101]

    assert divisor_count(0) == 0
    assert divisor_count(-1) == 1
    assert divisor_count(1) == 1
    assert divisor_count(6) == 4
    assert divisor_count(12) == 6
コード例 #2
0
ファイル: test_ntheory.py プロジェクト: bibile/sympy
def divisors_and_divisor_count():
    assert divisors(-1) == [1]
    assert divisors(0) == []
    assert divisors(1) == [1]
    assert divisors(2) == [1, 2]
    assert divisors(3) == [1, 3]
    assert divisors(10) == [1, 2, 5, 10]
    assert divisors(100) == [1, 2, 4, 5, 10, 20, 25, 50, 100]
    assert divisors(101) == [1, 101]

    assert divisor_count(0) == 0
    assert divisor_count(-1) == 1
    assert divisor_count(1) == 1
    assert divisor_count(6) == 4
    assert divisor_count(12) == 6
コード例 #3
0
def test_divisors_and_divisor_count():
    assert divisors(-1) == [1]
    assert divisors(0) == []
    assert divisors(1) == [1]
    assert divisors(2) == [1, 2]
    assert divisors(3) == [1, 3]
    assert divisors(17) == [1, 17]
    assert divisors(10) == [1, 2, 5, 10]
    assert divisors(100) == [1, 2, 4, 5, 10, 20, 25, 50, 100]
    assert divisors(101) == [1, 101]

    assert divisor_count(0) == 0
    assert divisor_count(-1) == 1
    assert divisor_count(1) == 1
    assert divisor_count(6) == 4
    assert divisor_count(12) == 6

    assert divisor_count(180, 3) == divisor_count(180//3)
    assert divisor_count(2*3*5, 7) == 0
コード例 #4
0
def test_divisors_and_divisor_count():
    assert divisors(-1) == [1]
    assert divisors(0) == []
    assert divisors(1) == [1]
    assert divisors(2) == [1, 2]
    assert divisors(3) == [1, 3]
    assert divisors(17) == [1, 17]
    assert divisors(10) == [1, 2, 5, 10]
    assert divisors(100) == [1, 2, 4, 5, 10, 20, 25, 50, 100]
    assert divisors(101) == [1, 101]

    assert divisor_count(0) == 0
    assert divisor_count(-1) == 1
    assert divisor_count(1) == 1
    assert divisor_count(6) == 4
    assert divisor_count(12) == 6

    assert divisor_count(180, 3) == divisor_count(180//3)
    assert divisor_count(2*3*5, 7) == 0
コード例 #5
0
def test_divisor_count():
    assert divisor_count(0) == 0
    assert divisor_count(6) == 4
コード例 #6
0
def test_divisor_count():
    assert divisor_count(0) == 0
    assert divisor_count(6) == 4
コード例 #7
0
    check = True
    bases = []
    for i in range(2, 11):
        base = int(enclosed_num, i)
        bases.append(base)
        if isprime(base):
            check = False
            break

    #print(len(bases))
    if check == True:
        print(enclosed_num, end="")
        output.write(enclosed_num)
        for base in bases:
            if divisor_count(base) == 2:
                print("dafuq")
            print(' ', end="")
            print(primefactors(base)[0], end="")
            output.write(" ")
            output.write(str(primefactors(base)[0]))
        print()

        for base in bases:
            print('{} -> {}'.format(base, primefactors(base)))
        output.write("\n")
        counter += 1

    #if cur_num % 10 == 0:
    #    print(cur_num)
    cur_num += 1
コード例 #8
0
ファイル: functions.py プロジェクト: isaacsaffold/pyutils
def unrelated(n):
    """The amount of numbers less than n that are neither coprime to
    nor divisors of n."""
    return n - nthry.totient(n) - nthry.divisor_count(n) + 1