
    MZd                     6    d dl mZmZmZ d dlmZ d Zd Zd Zy)    )IntegerPowMod)	factorintc                 d   | dk  st        |       | k7  rt        d| z        t        |       } t        t	        |       j                               }d}|D ]U  \  }}|D ]F  \  }}t        t        d|dz         D cg c]  }t        t        ||      |      dk(   c}      sDd} n |rT |S  |S c c}w )aJ  
    Check whether `n` is a nilpotent number. A number `n` is said to be
    nilpotent if and only if every finite group of order `n` is nilpotent.
    For more information see [1]_.

    Examples
    ========

    >>> from sympy.combinatorics.group_numbers import is_nilpotent_number
    >>> from sympy import randprime
    >>> is_nilpotent_number(21)
    False
    >>> is_nilpotent_number(randprime(1, 30)**12)
    True

    References
    ==========

    .. [1] Pakianathan, J., Shankar, K., *Nilpotent Numbers*,
            The American Mathematical Monthly, 107(7), 631-634.


    r   $n must be a positive integer, not %iT   F)
int
ValueErrorr   listr   itemsanyranger   r   )nprime_factorsis_nilpotentp_ja_jp_ia_iks           C/usr/lib/python3/dist-packages/sympy/combinatorics/group_numbers.pyis_nilpotent_numberr      s    0 	AvQ1?!CDD
A1++-.ML! S% 	HCaq8IJ1CCS)Q.JK$	   Ks   7 B-c                     | dk  st        |       | k7  rt        d| z        t        |       } t        |       syt	        t        |       j                               }t        d |D              }|S )af  
    Check whether `n` is an abelian number. A number `n` is said to be abelian
    if and only if every finite group of order `n` is abelian. For more
    information see [1]_.

    Examples
    ========

    >>> from sympy.combinatorics.group_numbers import is_abelian_number
    >>> from sympy import randprime
    >>> is_abelian_number(4)
    True
    >>> is_abelian_number(randprime(1, 2000)**2)
    True
    >>> is_abelian_number(60)
    False

    References
    ==========

    .. [1] Pakianathan, J., Shankar, K., *Nilpotent Numbers*,
            The American Mathematical Monthly, 107(7), 631-634.


    r   r   Fc              3   ,   K   | ]  \  }}|d k    yw)   N .0r   r   s      r   	<genexpr>z$is_abelian_number.<locals>.<genexpr>P   s     ;cS1W;   r
   r   r   r   r   r   r   all)r   r   
is_abelians      r   is_abelian_numberr%   .   sg    4 	AvQ1?!CDD
Aq!1++-.M;];;J    c                     | dk  st        |       | k7  rt        d| z        t        |       } t        |       syt	        t        |       j                               }t        d |D              }|S )a^  
    Check whether `n` is a cyclic number. A number `n` is said to be cyclic
    if and only if every finite group of order `n` is cyclic. For more
    information see [1]_.

    Examples
    ========

    >>> from sympy.combinatorics.group_numbers import is_cyclic_number
    >>> from sympy import randprime
    >>> is_cyclic_number(15)
    True
    >>> is_cyclic_number(randprime(1, 2000)**2)
    False
    >>> is_cyclic_number(4)
    False

    References
    ==========

    .. [1] Pakianathan, J., Shankar, K., *Nilpotent Numbers*,
            The American Mathematical Monthly, 107(7), 631-634.

    r   r   Fc              3   ,   K   | ]  \  }}|d k    yw)   Nr   r   s      r   r    z#is_cyclic_number.<locals>.<genexpr>u   s     :SC!G:r!   r"   )r   r   	is_cyclics      r   is_cyclic_numberr+   T   sg    2 	AvQ1?!CDD
Aq!1++-.M:M::Ir&   N)	
sympy.corer   r   r   sympyr   r   r%   r+   r   r&   r   <module>r.      s    ( ( &R#L"r&   