当前位置: 首页>>代码示例>>Python>>正文


Python ntheory.divisor_count函数代码示例

本文整理汇总了Python中sympy.ntheory.divisor_count函数的典型用法代码示例。如果您正苦于以下问题:Python divisor_count函数的具体用法?Python divisor_count怎么用?Python divisor_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了divisor_count函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: divisors_and_divisor_count

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
开发者ID:bibile,项目名称:sympy,代码行数:15,代码来源:test_ntheory.py

示例2: test_divisors_and_divisor_count

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
开发者ID:LuckyStrikes1090,项目名称:sympy,代码行数:19,代码来源:test_ntheory.py

示例3: test_divisor_count

def test_divisor_count():
    assert divisor_count(0) == 0
    assert divisor_count(6) == 4
开发者ID:LuckyStrikes1090,项目名称:sympy,代码行数:3,代码来源:test_ntheory.py


注:本文中的sympy.ntheory.divisor_count函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。