
    Rie                     8    d dl mZmZmZ d dlmZ d Zd Zd ZdS )    )IntegerPowMod)	factorintc           
      h   | dk    st          |           | k    rt          d| z            t          |           } t          t	          |                                                     }d}|D ]B\  }|D ]6\  }t          fdt          d|dz             D                       rd} n7|s nC|S )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 %iTc                 T    g | ]$}t          t          |                    d k    %S )   )r   r   ).0kp_ip_js     Alib/python3.11/site-packages/sympy/combinatorics/group_numbers.py
<listcomp>z'is_nilpotent_number.<locals>.<listcomp>%   s0    JJJ1CCS))Q.JJJ    r
   F)int
ValueErrorr   listr   itemsanyrange)nprime_factorsis_nilpotenta_ja_ir   r   s        @@r   is_nilpotent_numberr      s    0 	AvvQ1?!CDDD

A1++--..ML!  S% 	 	HCJJJJJaq8I8IJJJKK $  	E	 r   c                 *   | dk    st          |           | k    rt          d| z            t          |           } t          |           sdS t	          t          |                                                     }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     V  dS )   N r   r   r   s      r   	<genexpr>z$is_abelian_number.<locals>.<genexpr>P   s*      ;;cS1W;;;;;;r   r   r   r   r   r   r   r   all)r   r   
is_abelians      r   is_abelian_numberr'   .   s    4 	AvvQ1?!CDDD

Aq!! u1++--..M;;];;;;;Jr   c                 *   | dk    st          |           | k    rt          d| z            t          |           } t          |           sdS t	          t          |                                                     }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     V  dS )   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   s    2 	AvvQ1?!CDDD

Aq!! u1++--..M::M:::::Ir   N)	
sympy.corer   r   r   sympyr   r   r'   r,   r!   r   r   <module>r/      sn    ( ( ( ( ( ( ( ( ( (      & & &R# # #L" " " " "r   