U
    9%e  ใ                   @   s<   d dl mZmZmZ d dlmZ dd Zdd Zdd Zd	S )
้    )ฺIntegerฺPowฺMod)ฺ	factorintc                    s   | dkst | | kr td|  t| } tt|  ก }d}|D ]H\}|D ]2\ }t fddtd|d D rLd} qqL|s@ qq@|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                    s    g | ]}t t |d kqS )้   )r   r   )ฺ.0ฺkฉฺp_iZp_jฉ ๚`/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/sympy/combinatorics/group_numbers.pyฺ
<listcomp>%   s     z'is_nilpotent_number.<locals>.<listcomp>r   F)ฺintฺ
ValueErrorr   ฺlistr   ฺitemsฺanyฺrange)ฺnฺprime_factorsZis_nilpotentZa_jฺa_ir   r
   r   ฺis_nilpotent_number   s    "r   c                 C   sZ   | dkst | | kr td|  t| } t| s4dS tt|  ก }td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                 s   s   | ]\}}|d k V  qdS )้   Nr   ฉr   r   r   r   r   r   ฺ	<genexpr>P   s     z$is_abelian_number.<locals>.<genexpr>ฉr   r   r   r   r   r   r   ฺall)r   r   Z
is_abelianr   r   r   ฺis_abelian_number.   s    r   c                 C   sZ   | dkst | | kr td|  t| } t| s4dS tt|  ก }td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                 s   s   | ]\}}|d k V  qdS )้   Nr   r   r   r   r   r   u   s     z#is_cyclic_number.<locals>.<genexpr>r   )r   r   Z	is_cyclicr   r   r   ฺis_cyclic_numberT   s    r    N)	Z
sympy.corer   r   r   Zsympyr   r   r   r    r   r   r   r   ฺ<module>   s   )&