§
    OŠtj`‚  ã                   ó  — d Z ddlmZmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ dd	lmZ dd
lmZ d„ Z G d„ d¦  «        Z e¦   «         Zd„ Z eddd¬¦  «        d„ ¦   «         Zdedefd„Zd"d„Zd„ Zd#d„Zd„ Zd$d„Zd%d„Zd „ Zd!„ ZdS )&z"
Generating and counting primes.

é    )ÚbisectÚbisect_left©Úcount)Úarray)Úrandint)Úsqrté   )Úisprime)Ú
deprecated)Úas_intc                 ó>   — ddl m} t           || ¦  «        ¦  «        S )z� Wrapping ceiling in as_int will raise an error if there was a problem
        determining whether the expression was exactly an integer or not.r   )Úceiling)Ú#sympy.functions.elementary.integersr   r   )Úar   s     úT/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/ntheory/generate.pyÚ_as_int_ceilingr      s,   € ð <Ð;Ð;Ð;Ð;Ð;Ý�'�'˜!‘*”*ÑÔÐó    c                   óf   — e Zd ZdZdd„Zd„ Zdd„Zd„ Zd„ Zd	„ Z	dd
„Z
d„ Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )ÚSievea  A list of prime numbers, implemented as a dynamically
    growing sieve of Eratosthenes. When a lookup is requested involving
    an odd number that has not been sieved, the sieve is automatically
    extended up to that number. Implementation details limit the number of
    primes to ``2^32-1``.

    Examples
    ========

    >>> from sympy import sieve
    >>> sieve._reset() # this line for doctest only
    >>> 25 in sieve
    False
    >>> sieve._list
    array('L', [2, 3, 5, 7, 11, 13, 17, 19, 23])
    é@B c                 ó6  ‡ — d‰ _         t          dg d¢¦  «        ‰ _        t          dg d¢¦  «        ‰ _        t          dg d¢¦  «        ‰ _        |dk    rt          d¦  «        ‚|‰ _        t          ˆ fd	„‰ j        ‰ j        ‰ j        fD ¦   «         ¦  «        sJ ‚d
S )zú Initial parameters for the Sieve class.

        Parameters
        ==========

        sieve_interval (int): Amount of memory to be used

        Raises
        ======

        ValueError
            If ``sieve_interval`` is not positive.

        é   ÚL)é   é   é   é   é   é   )r   r
   r
   r   r   é   Úi)r   r
   éÿÿÿÿr#   r   r#   r   z+sieve_interval should be a positive integerc              3   óH   •K  — | ]}t          |¦  «        ‰j        k    V — Œd S ©N)ÚlenÚ_n)Ú.0r"   Úselfs     €r   ú	<genexpr>z!Sieve.__init__.<locals>.<genexpr>C   s0   øè è € ÐUÐU¨•3�q‘6”6˜TœWÒ$ÐUÐUÐUÐUÐUÐUr   N)r'   Ú_arrayÚ_listÚ_tlistÚ_mlistÚ
ValueErrorÚsieve_intervalÚall)r)   r0   s   ` r   Ú__init__zSieve.__init__-   s²   ø€ ð ˆŒÝ˜CÐ!5Ð!5Ð!5Ñ6Ô6ˆŒ
Ý˜SÐ"4Ð"4Ð"4Ñ5Ô5ˆŒÝ˜SÐ"7Ð"7Ð"7Ñ8Ô8ˆŒØ˜QÒÐÝÐJÑKÔKÐKØ,ˆÔÝÐUÐUÐUÐU¨t¬z¸4¼;ÈÌÐ.TÐUÑUÔUÑUÔUÐUÐUÐUÐUÐUr   c                 óì  — ddt          | j        ¦  «        | j        d         | j        d         | j        d         | j        d         | j        d         dt          | j        ¦  «        | j        d         | j        d         | j        d         | j        d         | j        d         d	t          | j        ¦  «        | j        d         | j        d         | j        d         | j        d         | j        d         fz  S )
Nzs<%s sieve (%i): %i, %i, %i, ... %i, %i
%s sieve (%i): %i, %i, %i, ... %i, %i
%s sieve (%i): %i, %i, %i, ... %i, %i>Úprimer   r
   r   éþÿÿÿr#   ÚtotientÚmobius)r&   r,   r-   r.   )r)   s    r   Ú__repr__zSieve.__repr__E   sÄ   € ð6ð •c˜$œ*‘o”oØ”˜A” ¤
¨1¤¨t¬z¸!¬}Ø”˜B” ¤¨B¤Ø�˜DœKÑ(Ô(Ø”˜Q” ¤¨Q¤Ø”˜Q” ¤¨R¤°$´+¸b´/Ø•s˜4œ;Ñ'Ô'Ø”˜Q” ¤¨Q¤Ø”˜Q” ¤¨R¤°$´+¸b´/ð	:CñCð 	Cr   Nc                 óð   — t          d„ |||fD ¦   «         ¦  «        rdx}x}}|r| j        d| j        …         | _        |r| j        d| j        …         | _        |r| j        d| j        …         | _        dS dS )z]Reset all caches (default). To reset one or more set the
            desired keyword to True.c              3   ó   K  — | ]}|d u V — Œ	d S r%   © ©r(   r"   s     r   r*   zSieve._reset.<locals>.<genexpr>V   s&   è è € Ð;Ð;˜Qˆq�DˆyÐ;Ð;Ð;Ð;Ð;Ð;r   TN)r1   r,   r'   r-   r.   )r)   r4   r6   r7   s       r   Ú_resetzSieve._resetS   s›   € õ Ð;Ð; 5¨'°6Ð":Ð;Ñ;Ô;Ñ;Ô;ð 	,Ø'+Ð+ˆEÐ+�G˜fØð 	.Øœ H T¤W HÔ-ˆDŒJØð 	0Øœ+ h t¤w hÔ/ˆDŒKØð 	0Øœ+ h t¤w hÔ/ˆDŒKˆKˆKð	0ð 	0r   c           
      óR  — t          |¦  «        }| j        d         dz   }||k     rdS |dz  }||k    r?| xj        t          d|                      ||¦  «        ¦  «        z  c_        ||dz  }}||k    °?| xj        t          d|                      ||dz   ¦  «        ¦  «        z  c_        dS )z÷Grow the sieve to cover all primes <= n.

        Examples
        ========

        >>> from sympy import sieve
        >>> sieve._reset() # this line for doctest only
        >>> sieve.extend(30)
        >>> sieve[10] == 29
        True
        r#   r
   Nr   r   )Úintr,   r+   Ú_primerange)r)   ÚnÚnumÚnum2s       r   ÚextendzSieve.extend_   s·   € õ �‰FŒFˆð Œj˜Œn˜qÑ ˆØˆsŠ7ˆ7ØˆFØ�A‰vˆØ�aŠiˆiØˆJŒJ�&  d×&6Ò&6°s¸DÑ&AÔ&AÑBÔBÑBˆJŒJØ˜d A™g�ˆCð �aŠiˆið 	ˆ
Œ
•f˜S $×"2Ò"2°3¸¸A¹Ñ">Ô">Ñ?Ô?Ñ?ˆ
Œ
ˆ
ˆ
r   c           
   #   ó–  K  — |dz  r|dz  }||k     r¶t          | j        ||z
  dz  ¦  «        }dg|z  }| j        dt          | j        t	          |d|z  z   dz   ¦  «        ¦  «        …         D ](}t          |dz   |z    dz  |z  ||¦  «        D ]}d||<   ŒŒ)t          |¦  «        D ]\  }}|r|d|z  z   dz   V — Œ|d|z  z  }||k     °´dS dS )a?   Generate all prime numbers in the range (a, b).

        Parameters
        ==========

        a, b : positive integers assuming the following conditions
                * a is an even number
                * 2 < self._list[-1] < a < b < nextprime(self._list[-1])**2

        Yields
        ======

        p (int): prime numbers such that ``a < p < b``

        Examples
        ========

        >>> from sympy.ntheory.generate import Sieve
        >>> s = Sieve()
        >>> s._list[-1]
        13
        >>> list(s._primerange(18, 31))
        [19, 23, 29]

        r   r
   TFN)Úminr0   r,   r   r	   ÚrangeÚ	enumerate)r)   r   ÚbÚ
block_sizeÚblockÚpÚtÚidxs           r   r@   zSieve._primerangex   s'  è è € ð4 ˆq‰5ð 	Ø�‰FˆAØ�!ŠeˆeÝ˜TÔ0°1°q±5¸Q±,Ñ?Ô?ˆJð �F˜ZÑ'ˆEØ”Z ¥&¨¬µT¸!¸aÀ*¹nÑ:LÈqÑ:PÑ5QÔ5QÑ"RÔ"RÐ RÔSð %ð %�Ý ! a¡%¨!¡) °Ñ 1°QÑ6¸
ÀAÑFÔFð %ð %�AØ$�E˜!‘H�Hð%å# EÑ*Ô*ð *ð *‘��QØð *Ø˜a #™g™+¨™/Ð)Ð)Ð)øØ��Z‘ÑˆAð �!Šeˆeˆeˆeˆeˆer   c                 óè   — t          |¦  «        }t          | j        ¦  «        |k     rJ|                      t	          | j        d         dz  ¦  «        ¦  «         t          | j        ¦  «        |k     °HdS dS )að  Extend to include the ith prime number.

        Parameters
        ==========

        i : integer

        Examples
        ========

        >>> from sympy import sieve
        >>> sieve._reset() # this line for doctest only
        >>> sieve.extend_to_no(9)
        >>> sieve._list
        array('L', [2, 3, 5, 7, 11, 13, 17, 19, 23])

        Notes
        =====

        The list is extended by 50% if it is too short, so it is
        likely that it will be longer than requested.
        r#   g      ø?N)r   r&   r,   rD   r?   )r)   r"   s     r   Úextend_to_nozSieve.extend_to_no¡   sh   € õ. �1‰IŒIˆÝ�$”*‰oŒo Ò!Ð!Ø�KŠK�˜DœJ rœN¨SÑ0Ñ1Ô1Ñ2Ô2Ð2õ �$”*‰oŒo Ò!Ð!Ð!Ð!Ð!Ð!r   c              #   ó:  K  — |€t          |¦  «        }d}n,t          dt          |¦  «        ¦  «        }t          |¦  «        }||k    rdS |                      |¦  «         | j        t	          | j        |¦  «        t	          | j        |¦  «        …         E d{V —† dS )a(  Generate all prime numbers in the range [2, a) or [a, b).

        Examples
        ========

        >>> from sympy import sieve, prime

        All primes less than 19:

        >>> print([i for i in sieve.primerange(19)])
        [2, 3, 5, 7, 11, 13, 17]

        All primes greater than or equal to 7 and less than 19:

        >>> print([i for i in sieve.primerange(7, 19)])
        [7, 11, 13, 17]

        All primes through the 10th prime

        >>> list(sieve.primerange(prime(10) + 1))
        [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]

        Nr   )r   ÚmaxrD   r,   r   )r)   r   rI   s      r   Ú
primerangezSieve.primerange¼   s»   è è € ð0 ˆ9Ý Ñ"Ô"ˆAØˆAˆAå�A• qÑ)Ô)Ñ*Ô*ˆAÝ Ñ"Ô"ˆAØ�Š6ˆ6ØˆFØ�Š�A‰ŒˆØ”:�k¨$¬*°aÑ8Ô8Ý)¨$¬*°aÑ8Ô8ð9ô :ð 	:ð 	:ð 	:ð 	:ð 	:ð 	:ð 	:ð 	:ð 	:r   c           	   #   ó  K  — t          dt          |¦  «        ¦  «        }t          |¦  «        }t          | j        ¦  «        }||k    rdS ||k    r$t	          ||¦  «        D ]}| j        |         V — ŒdS | xj        t          dt	          ||¦  «        ¦  «        z  c_        t	          d|¦  «        D ]g}| j        |         }||dz
  k    rE||z   dz
  |z  |z  }t	          |||¦  «        D ]%}| j        |xx         | j        |         |z  z  cc<   Œ&||k    r|V — Œht	          ||¦  «        D ]a}| j        |         }||k    r7t	          |||¦  «        D ]%}| j        |xx         | j        |         |z  z  cc<   Œ&||k    r| j        |         V — ŒbdS )zêGenerate all totient numbers for the range [a, b).

        Examples
        ========

        >>> from sympy import sieve
        >>> print([i for i in sieve.totientrange(7, 18)])
        [6, 4, 6, 4, 10, 4, 12, 6, 8, 8, 16]
        r
   Nr   )rR   r   r&   r-   rG   r+   )r)   r   rI   rA   r"   ÚtiÚ
startindexÚjs           r   ÚtotientrangezSieve.totientrangeà   sÔ  è è € õ �•? 1Ñ%Ô%Ñ&Ô&ˆÝ˜AÑÔˆÝ�”ÑÔˆØ�Š6ˆ6ØˆFØ�!ŠVˆVÝ˜1˜a‘[”[ð %ð %�Ø”k !”nÐ$Ð$Ð$Ð$ð%ð %ð ˆKŒK�6 #¥u¨Q°¡{¤{Ñ3Ô3Ñ3ˆKŒKÝ˜1˜a‘[”[ð ð �Ø”[ ”^�Ø˜˜Q™’;�;Ø"# a¡%¨!¡)°Ñ!1°AÑ!5�JÝ" :¨q°!Ñ4Ô4ð >ð >˜Øœ A˜˜œ¨$¬+°a¬.¸AÑ*=Ñ=˜˜™˜Ø˜’6�6Ø�H�H�Høå˜1˜a‘[”[ð )ð )�Ø”[ ”^�Ø˜’7�7Ý" 1 a¨™^œ^ð >ð >˜Øœ A˜˜œ¨$¬+°a¬.¸AÑ*=Ñ=˜˜™˜Ø˜’6�6Øœ+ aœ.Ð(Ð(Ð(øð)ð )r   c              #   ó¦  K  — t          dt          |¦  «        ¦  «        }t          |¦  «        }t          | j        ¦  «        }||k    rdS ||k    r$t	          ||¦  «        D ]}| j        |         V — ŒdS | xj        t          ddg||z
  z  ¦  «        z  c_        t	          d|¦  «        D ]P}| j        |         }||z   dz
  |z  |z  }t	          |||¦  «        D ]}| j        |xx         |z  cc<   Œ||k    r|V — ŒQt	          ||¦  «        D ]E}| j        |         }t	          d|z  ||¦  «        D ]}| j        |xx         |z  cc<   Œ||k    r|V — ŒFdS )a†  Generate all mobius numbers for the range [a, b).

        Parameters
        ==========

        a : integer
            First number in range

        b : integer
            First number outside of range

        Examples
        ========

        >>> from sympy import sieve
        >>> print([i for i in sieve.mobiusrange(7, 18)])
        [-1, 0, 0, 1, -1, 0, -1, 1, 1, 0, -1]
        r
   Nr"   r   r   )rR   r   r&   r.   rG   r+   )r)   r   rI   rA   r"   ÚmirV   rW   s           r   ÚmobiusrangezSieve.mobiusrange  s§  è è € õ& �•? 1Ñ%Ô%Ñ&Ô&ˆÝ˜AÑÔˆÝ�”ÑÔˆØ�Š6ˆ6ØˆFØ�!ŠVˆVÝ˜1˜a‘[”[ð %ð %�Ø”k !”nÐ$Ð$Ð$Ð$ð%ð %ð ˆKŒK�6 #¨ s¨A°©E¡{Ñ3Ô3Ñ3ˆKŒKÝ˜1˜a‘[”[ð ð �Ø”[ ”^�Ø !™e a™i¨AÑ-°Ñ1�
Ý˜z¨1¨aÑ0Ô0ð )ð )�AØ”K �N�N”N bÑ(�N�N‘N�NØ˜’6�6Ø�H�H�Høå˜1˜a‘[”[ð ð �Ø”[ ”^�Ý˜q 1™u a¨Ñ+Ô+ð )ð )�AØ”K �N�N”N bÑ(�N�N‘N�NØ˜’6�6Ø�H�H�Høðð r   c                 ó"  — t          |¦  «        }t          |¦  «        }|dk     rt          d|z  ¦  «        ‚|| j        d         k    r|                      |¦  «         t          | j        |¦  «        }| j        |dz
           |k    r||fS ||dz   fS )a~  Return the indices i, j of the primes that bound n.

        If n is prime then i == j.

        Although n can be an expression, if ceiling cannot convert
        it to an integer then an n error will be raised.

        Examples
        ========

        >>> from sympy import sieve
        >>> sieve.search(25)
        (9, 10)
        >>> sieve.search(23)
        (9, 9)
        r   zn should be >= 2 but got: %sr#   r
   )r   r   r/   r,   rD   r   )r)   rA   ÚtestrI   s       r   ÚsearchzSieve.search1  s–   € õ" ˜qÑ!Ô!ˆÝ�1‰IŒIˆØˆqŠ5ˆ5ÝÐ;¸aÑ?Ñ@Ô@Ð@ØˆtŒz˜"Œ~ÒÐØ�KŠK˜‰NŒNˆNÝ�4”:˜qÑ!Ô!ˆØŒ:�a˜!‘eÔ Ò$Ð$Ø�a�4ˆKà�a˜!‘e�8ˆOr   c                 ó¾   — 	 t          |¦  «        }|dk    sJ ‚n# t          t          f$ r Y dS w xY w|dz  dk    r|dk    S |                      |¦  «        \  }}||k    S )Nr   Fr   )r   r/   ÚAssertionErrorr^   )r)   rA   r   rI   s       r   Ú__contains__zSieve.__contains__N  sz   € ð	Ý�q‘	”	ˆAØ˜’6�6�6�6�6øÝ�NÐ+ð 	ð 	ð 	Ø�5�5ð	øøøàˆq‰5�AŠ:ˆ:Ø˜’6ˆMØ�{Š{˜1‰~Œ~‰ˆˆ1Ø�AŠvˆs   ‚ š/®/c              #   óB   K  — t          d¦  «        D ]}| |         V — Œd S )Nr
   r   )r)   rA   s     r   Ú__iter__zSieve.__iter__Y  s4   è è € Ý�q‘”ð 	ð 	ˆAØ�q”'ˆMˆMˆMˆMð	ð 	r   c                 ó|  — t          |t          ¦  «        r_|                      |j        ¦  «         |j        �|j        nd}|dk     rt          d¦  «        ‚| j        |dz
  |j        dz
  |j        …         S |dk     rt          d¦  «        ‚t          |¦  «        }|                      |¦  «         | j        |dz
           S )zReturn the nth prime numberNr   r
   zSieve indices start at 1.)	Ú
isinstanceÚslicerP   ÚstopÚstartÚ
IndexErrorr,   Ústepr   )r)   rA   rh   s      r   Ú__getitem__zSieve.__getitem__]  sÀ   € å�a�ÑÔð 	%Ø×Ò˜aœfÑ%Ô%Ð%Ø œwÐ2�A”G�G¸ˆEØ�qŠyˆyõ !Ð!<Ñ=Ô=Ð=Ø”:˜e a™i¨¬°©
°1´6Ð9Ô:Ð:à�1Šuˆuõ !Ð!<Ñ=Ô=Ð=Ý�q‘	”	ˆAØ×Ò˜aÑ Ô Ð Ø”:˜a !™eÔ$Ð$r   )r   )NNNr%   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r2   r8   r=   rD   r@   rP   rS   rX   r[   r^   ra   rc   rk   r;   r   r   r   r      sþ   € € € € € ðð ð$Vð Vð Vð Vð0Cð Cð Cð
0ð 
0ð 
0ð 
0ð@ð @ð @ð2' ð ' ð ' ðR3ð 3ð 3ð6":ð ":ð ":ð ":ðH#)ð #)ð #)ðJ*ð *ð *ðXð ð ð:	ð 	ð 	ðð ð ð%ð %ð %ð %ð %r   r   c           	      óˆ  — t          | ¦  «        }|dk     rt          d¦  «        ‚|t          t          j        ¦  «        k    rt          |         S ddlm} ddlm} |dk     r*t           	                    d|z  ¦  «         t          |         S d}t          | ||¦  «                             ¦   «          | ||¦  «        ¦  «                             ¦   «         z   z  ¦  «        }||k     r7||z   dz	  } ||¦  «                             ¦   «         |k    r|}n|dz   }||k     °7t          |dz
  |t          |dz
  ¦  «        z
  ¦  «        S )	a…  
    Return the nth prime number, where primes are indexed starting from 1:
    prime(1) = 2, prime(2) = 3, etc.

    Parameters
    ==========

    nth : int
        The position of the prime number to return (must be a positive integer).

    Returns
    =======

    int
        The nth prime number.

    Examples
    ========

    >>> from sympy import prime
    >>> prime(10)
    29
    >>> prime(1)
    2
    >>> prime(100000)
    1299709

    See Also
    ========

    sympy.ntheory.primetest.isprime : Test if a number is prime.
    primerange : Generate all primes in a given range.
    primepi : Return the number of primes less than or equal to a given number.

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/Prime_number_theorem
    .. [2] https://en.wikipedia.org/wiki/Logarithmic_integral_function
    .. [3] https://en.wikipedia.org/wiki/Skewes%27_number
    r
   z-nth must be a positive integer; prime(1) == 2r   ©Úlog©Úliiè  é   r   )r   r/   r&   Úsiever,   Ú&sympy.functions.elementary.exponentialrr   Ú'sympy.functions.special.error_functionsrt   rD   r?   ÚevalfÚ	nextprimeÚ_primepi)ÚnthrA   rr   rt   r   rI   Úmids          r   r4   r4   s  sO  € õT 	ˆs‰Œ€AØˆ1‚u€uÝÐHÑIÔIÐIð 	�C•”ÑÔÒÐÝ�QŒxˆà:Ð:Ð:Ð:Ð:Ð:Ø:Ð:Ð:Ð:Ð:Ð:àˆ4‚x€xå�Š�Q˜‘UÑÔÐÝ�QŒxˆà	€AåˆA���Q‘”—’‘” # # c c¨!¡f¤f¡+¤+×"3Ò"3Ñ"5Ô"5Ñ5Ñ6Ñ7Ô7€Að ˆaŠ%ˆ%Ø�1‰u˜‰lˆØˆ2ˆc‰7Œ7�=Š=‰?Œ?˜QÒÐØˆAˆAà�a‘ˆAð ˆaŠ%ˆ%õ �Q˜‘U˜A¥¨¨Q©¡¤Ñ/Ñ0Ô0Ð0r   zgThe `sympy.ntheory.generate.primepi` has been moved to `sympy.functions.combinatorial.numbers.primepi`.z1.13z%deprecated-ntheory-symbolic-functions)Údeprecated_since_versionÚactive_deprecations_targetc                 ó$   — ddl m}  || ¦  «        S )a�
   Represents the prime counting function pi(n) = the number
        of prime numbers less than or equal to n.

        .. deprecated:: 1.13

            The ``primepi`` function is deprecated. Use :class:`sympy.functions.combinatorial.numbers.primepi`
            instead. See its documentation for more information. See
            :ref:`deprecated-ntheory-symbolic-functions` for details.

        Algorithm Description:

        In sieve method, we remove all multiples of prime p
        except p itself.

        Let phi(i,j) be the number of integers 2 <= k <= i
        which remain after sieving from primes less than
        or equal to j.
        Clearly, pi(n) = phi(n, sqrt(n))

        If j is not a prime,
        phi(i,j) = phi(i, j - 1)

        if j is a prime,
        We remove all numbers(except j) whose
        smallest prime factor is j.

        Let $x= j \times a$ be such a number, where $2 \le a \le i / j$
        Now, after sieving from primes $\le j - 1$,
        a must remain
        (because x, and hence a has no prime factor $\le j - 1$)
        Clearly, there are phi(i / j, j - 1) such a
        which remain on sieving from primes $\le j - 1$

        Now, if a is a prime less than equal to j - 1,
        $x= j \times a$ has smallest prime factor = a, and
        has already been removed(by sieving from a).
        So, we do not need to remove it again.
        (Note: there will be pi(j - 1) such x)

        Thus, number of x, that will be removed are:
        phi(i / j, j - 1) - phi(j - 1, j - 1)
        (Note that pi(j - 1) = phi(j - 1, j - 1))

        $\Rightarrow$ phi(i,j) = phi(i, j - 1) - phi(i / j, j - 1) + phi(j - 1, j - 1)

        So,following recursion is used and implemented as dp:

        phi(a, b) = phi(a, b - 1), if b is not a prime
        phi(a, b) = phi(a, b-1)-phi(a / b, b-1) + phi(b-1, b-1), if b is prime

        Clearly a is always of the form floor(n / k),
        which can take at most $2\sqrt{n}$ values.
        Two arrays arr1,arr2 are maintained
        arr1[i] = phi(i, j),
        arr2[i] = phi(n // i, j)

        Finally the answer is arr2[1]

        Examples
        ========

        >>> from sympy import primepi, prime, prevprime, isprime
        >>> primepi(25)
        9

        So there are 9 primes less than or equal to 25. Is 25 prime?

        >>> isprime(25)
        False

        It is not. So the first prime less than 25 must be the
        9th prime:

        >>> prevprime(25) == prime(9)
        True

        See Also
        ========

        sympy.ntheory.primetest.isprime : Test if n is prime
        primerange : Generate all primes in a given range
        prime : Return the nth prime
    r   )Úprimepi)Ú%sympy.functions.combinatorial.numbersr�   )rA   Úfunc_primepis     r   r�   r�   ¼  s&   € ðp NÐMÐMÐMÐMÐMØˆ<˜‰?Œ?Ðr   rA   Úreturnc           	      ó>  ‡ — ‰ dk     rdS ‰ t           j        d         k    r t                                ‰ ¦  «        d         S t          ‰ ¦  «        }d„ t	          |dz   ¦  «        D ¦   «         }dgˆ fd„t	          d|dz   ¦  «        D ¦   «         z   }dg|dz   z  }t	          d|dz   d¦  «        D ]ë}||         rŒ||dz
           }t	          ||dz   |¦  «        D ]}d	||<   Œt	          dt          ‰ ||z  z  |¦  «        dz   d¦  «        D ]L}||         rŒ||z  }||k    r||xx         ||         |z
  z  cc<   Œ0||xx         |‰ |z           |z
  z  cc<   ŒMt	          |t          |||z  dz
  ¦  «        d¦  «        D ]}||xx         |||z           |z
  z  cc<   ŒŒì|d         S )
aÚ   Represents the prime counting function pi(n) = the number
    of prime numbers less than or equal to n.

    Explanation
    ===========

    In sieve method, we remove all multiples of prime p
    except p itself.

    Let phi(i,j) be the number of integers 2 <= k <= i
    which remain after sieving from primes less than
    or equal to j.
    Clearly, pi(n) = phi(n, sqrt(n))

    If j is not a prime,
    phi(i,j) = phi(i, j - 1)

    if j is a prime,
    We remove all numbers(except j) whose
    smallest prime factor is j.

    Let $x= j \times a$ be such a number, where $2 \le a \le i / j$
    Now, after sieving from primes $\le j - 1$,
    a must remain
    (because x, and hence a has no prime factor $\le j - 1$)
    Clearly, there are phi(i / j, j - 1) such a
    which remain on sieving from primes $\le j - 1$

    Now, if a is a prime less than equal to j - 1,
    $x= j \times a$ has smallest prime factor = a, and
    has already been removed(by sieving from a).
    So, we do not need to remove it again.
    (Note: there will be pi(j - 1) such x)

    Thus, number of x, that will be removed are:
    phi(i / j, j - 1) - phi(j - 1, j - 1)
    (Note that pi(j - 1) = phi(j - 1, j - 1))

    $\Rightarrow$ phi(i,j) = phi(i, j - 1) - phi(i / j, j - 1) + phi(j - 1, j - 1)

    So,following recursion is used and implemented as dp:

    phi(a, b) = phi(a, b - 1), if b is not a prime
    phi(a, b) = phi(a, b-1)-phi(a / b, b-1) + phi(b-1, b-1), if b is prime

    Clearly a is always of the form floor(n / k),
    which can take at most $2\sqrt{n}$ values.
    Two arrays arr1,arr2 are maintained
    arr1[i] = phi(i, j),
    arr2[i] = phi(n // i, j)

    Finally the answer is arr2[1]

    Parameters
    ==========

    n : int

    r   r   r#   c                 ó   — g | ]
}|d z   d z	  ‘ŒS ©r
   r;   r<   s     r   ú
<listcomp>z_primepi.<locals>.<listcomp>Y  s    € Ð1Ð1Ð1˜QˆQ�‰U�q‰LÐ1Ð1Ð1r   r
   c                 ó&   •— g | ]}‰|z  d z   d z	  ‘ŒS r‡   r;   )r(   r"   rA   s     €r   rˆ   z_primepi.<locals>.<listcomp>Z  s%   ø€ Ð=Ð=Ð= a�1�a‘4˜!‘8 ‘/Ð=Ð=Ð=r   Fr   T)rv   r,   r^   r	   rG   rF   )	rA   ÚlimÚarr1Úarr2Úskipr"   rL   rW   Ústs	   `        r   r{   r{     s  ø€ ðx 	ˆ1‚u€uØˆqØ�EŒK˜ŒOÒÐÝ�|Š|˜A‰Œ˜qÔ!Ð!Ý
ˆq‰'Œ'€CØ1Ð1¥%¨¨a©¡.¤.Ð1Ñ1Ô1€DØˆ3Ð=Ð=Ð=Ð=­5°°C¸!±GÑ+<Ô+<Ð=Ñ=Ô=Ñ=€DØˆ7�c˜A‘gÑ€DÝ�1�c˜A‘g˜qÑ!Ô!ð (ð (ˆð �Œ7ð 	àØ��Q‘ŒKˆÝ�q˜# ™' 1Ñ%Ô%ð 	ð 	ˆAØˆD�‰GˆGõ �q�#˜a A¨¡E™l¨CÑ0Ô0°1Ñ4°aÑ8Ô8ð 		-ð 		-ˆAð �AŒwð ØØ�Q‘ˆBØ�SŠyˆyØ�Q��”˜4 œ8 a™<Ñ'��‘�à�Q��”˜4  R¡œ=¨1Ñ,Ñ,��‘�õ
 �s�C  Q q¡S¨1¡WÑ-Ô-¨rÑ2Ô2ð 	(ð 	(ˆAØ�ˆGˆGŒG�t˜A ™F”| aÑ'Ñ'ˆGˆG‰GˆGð	(à�Œ7€Nr   c                 óü  — t          | ¦  «        } t          |¦  «        }|dk    rt          d¦  «        ‚| dk     rd} |dz  }| t          j        d         k    r‰t                               | ¦  «        \  }}||z   dz
  t          t          j        ¦  «        k     rt          j        ||z   dz
           S t          j        d         } ||t          t          j        ¦  «        z
  z  }d| dz  z  }|| k    r#| dz  } t          | ¦  «        r	|dz  }|s| S | dz  } n1| |z
  d	k    r#| dz  } t          | ¦  «        r	|dz  }|s| S | dz  } n|d	z   } 	 t          | ¦  «        r	|dz  }|s| S | dz  } t          | ¦  «        r	|dz  }|s| S | dz  } Œ;)
aU   Return the ith prime greater than n.

        Parameters
        ==========

        n : integer
        ith : positive integer

        Returns
        =======

        int : Return the ith prime greater than n

        Raises
        ======

        ValueError
            If ``ith <= 0``.
            If ``n`` or ``ith`` is not an integer.

        Notes
        =====

        Potential primes are located at 6*j +/- 1. This
        property is used during searching.

        >>> from sympy import nextprime
        >>> [(i, nextprime(i)) for i in range(10, 15)]
        [(10, 11), (11, 13), (12, 13), (13, 17), (14, 17)]
        >>> nextprime(2, ith=2) # the 2nd prime after 2
        5

        See Also
        ========

        prevprime : Return the largest prime smaller than n
        primerange : Generate all primes in a given range

    r   zith should be positiver   r
   r5   r#   r   r!   r   )r?   r   r/   rv   r,   r^   r&   r   )rA   Úithr"   ÚlÚ_Únns         r   rz   rz   z  sÄ  € õP 	ˆA‰Œ€AÝˆs‰Œ€AØˆA‚v€vÝÐ1Ñ2Ô2Ð2Øˆ1‚u€uØˆØ	ˆQ‰ˆØ�EŒK˜ŒOÒÐÝ�|Š|˜A‰Œ‰ˆˆ1Øˆq‰5�1‰9•s�5œ;Ñ'Ô'Ò'Ð'Ý”;˜q 1™u q™yÔ)Ð)ÝŒK˜ŒOˆØ	ˆQ••U”[Ñ!Ô!Ñ!Ñ!ˆØ	
ˆAˆq‰D‰€BØ	ˆQ‚w€wØ	ˆQ‰ˆÝ�1‰:Œ:ð 	Ø�‰FˆAØð Ø�Ø	ˆQ‰ˆˆØ	
ˆR‰�1ŠˆØ	ˆQ‰ˆÝ�1‰:Œ:ð 	Ø�‰FˆAØð Ø�Ø	ˆQ‰ˆˆà�‰Fˆð
Ý�1‰:Œ:ð 	Ø�‰FˆAØð Ø�Ø	ˆQ‰ˆÝ�1‰:Œ:ð 	Ø�‰FˆAØð Ø�Ø	ˆQ‰ˆð
r   c                 óÞ  — t          | ¦  «        } | dk     rt          d¦  «        ‚| dk     rddddddœ|          S | t          j        d         k    r@t                               | ¦  «        \  }}||k    rt          |dz
           S t          |         S d	| d	z  z  }| |z
  dk    r|dz
  } t          | ¦  «        r| S | d
z  } n|dz   } 	 t          | ¦  «        r| S | dz  } t          | ¦  «        r| S | d
z  } Œ-)aß   Return the largest prime smaller than n.

        Notes
        =====

        Potential primes are located at 6*j +/- 1. This
        property is used during searching.

        >>> from sympy import prevprime
        >>> [(i, prevprime(i)) for i in range(10, 15)]
        [(10, 7), (11, 7), (12, 11), (13, 11), (14, 13)]

        See Also
        ========

        nextprime : Return the ith prime greater than n
        primerange : Generates all primes in a given range
    r   zno preceding primesru   r   r   )r   r!   r   r   r   r#   r
   r   r!   )r   r/   rv   r,   r^   r   )rA   r‘   Úur“   s       r   Ú	prevprimer–   Í  s  € õ& 	˜ÑÔ€AØˆ1‚u€uÝÐ.Ñ/Ô/Ð/Øˆ1‚u€uØ˜˜q Q¨1Ð-Ð-¨aÔ0Ð0Ø�EŒK˜ŒOÒÐÝ�|Š|˜A‰Œ‰ˆˆ1Ø�Š6ˆ6Ý˜˜1™”:Ðå˜”8ˆOØ	
ˆAˆq‰D‰€BØˆ2�v�‚{€{Ø�‰FˆÝ�1‰:Œ:ð 	ØˆHØ	ˆQ‰ˆˆà�‰FˆðÝ�1‰:Œ:ð 	ØˆHØ	ˆQ‰ˆÝ�1‰:Œ:ð 	ØˆHØ	ˆQ‰ˆðr   Nc              #   óì  K  — |€d| }} | |k    rdS t           j        d         }||k    r#t                                | |¦  «        E d{V —† dS | |k    r8t           j        t          t           j        | ¦  «        d…         E d{V —† |dz   } n
| dz  r| dz  } t	          ||dz  ¦  «        }| |k     r#t                                | |¦  «        E d{V —† |} || k    rdS 	 t          | ¦  «        } | |k     r| V — ndS Œ)a
   Generate a list of all prime numbers in the range [2, a),
        or [a, b).

        If the range exists in the default sieve, the values will
        be returned from there; otherwise values will be returned
        but will not modify the sieve.

        Examples
        ========

        >>> from sympy import primerange, prime

        All primes less than 19:

        >>> list(primerange(19))
        [2, 3, 5, 7, 11, 13, 17]

        All primes greater than or equal to 7 and less than 19:

        >>> list(primerange(7, 19))
        [7, 11, 13, 17]

        All primes through the 10th prime

        >>> list(primerange(prime(10) + 1))
        [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]

        The Sieve method, primerange, is generally faster but it will
        occupy more memory as the sieve stores values. The default
        instance of Sieve, named sieve, can be used:

        >>> from sympy import sieve
        >>> list(sieve.primerange(1, 30))
        [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]

        Notes
        =====

        Some famous conjectures about the occurrence of primes in a given
        range are [1]:

        - Twin primes: though often not, the following will give 2 primes
                    an infinite number of times:
                        primerange(6*n - 1, 6*n + 2)
        - Legendre's: the following always yields at least one prime
                        primerange(n**2, (n+1)**2+1)
        - Bertrand's (proven): there is always a prime in the range
                        primerange(n, 2*n)
        - Brocard's: there are at least four primes in the range
                        primerange(prime(n)**2, prime(n+1)**2)

        The average gap between primes is log(n) [2]; the gap between
        primes can be arbitrarily large since sequences of composite
        numbers are arbitrarily large, e.g. the numbers in the sequence
        n! + 2, n! + 3 ... n! + n are all composite.

        See Also
        ========

        prime : Return the nth prime
        nextprime : Return the ith prime greater than n
        prevprime : Return the largest prime smaller than n
        randprime : Returns a random prime in a given range
        primorial : Returns the product of primes based on condition
        Sieve.primerange : return range from already computed primes
                           or extend the sieve to contain the requested
                           range.

        References
        ==========

        .. [1] https://en.wikipedia.org/wiki/Prime_number
        .. [2] https://primes.utm.edu/notes/gaps.html
    Nr   r#   r
   )rv   r,   rS   r   rF   r@   rz   )r   rI   Úlargest_known_primeÚtails       r   rS   rS   ü  sO  è è € ðV 	€yØ�!ˆ1ˆØˆA‚v€vØˆåœ+ bœ/ÐØÐÒÐÝ×#Ò# A qÑ)Ô)Ð)Ð)Ð)Ð)Ð)Ð)Ð)ØˆàÐÒÐÝ”;�{­5¬;¸Ñ:Ô:Ð;Ð;Ô<Ð<Ð<Ð<Ð<Ð<Ð<Ð<Ø !Ñ#ˆˆØ	
ˆQ‰ð Ø	ˆQ‰ˆÝˆqÐ&¨Ñ*Ñ+Ô+€DØˆ4‚x€xÝ×$Ò$ Q¨Ñ-Ô-Ð-Ð-Ð-Ð-Ð-Ð-Ð-ØˆØˆA‚v€vØˆðÝ�a‰LŒLˆØˆqŠ5ˆ5ØˆGˆGˆGˆGàˆFðr   c                 óâ   — | |k    rdS t          t          | |f¦  «        \  } }t          | dz
  |¦  «        }t          |¦  «        }||k    rt	          |¦  «        }|| k     rt          d¦  «        ‚|S )aG   Return a random prime number in the range [a, b).

        Bertrand's postulate assures that
        randprime(a, 2*a) will always succeed for a > 1.

        Note that due to implementation difficulties,
        the prime numbers chosen are not uniformly random.
        For example, there are two primes in the range [112, 128),
        ``113`` and ``127``, but ``randprime(112, 128)`` returns ``127``
        with a probability of 15/17.

        Examples
        ========

        >>> from sympy import randprime, isprime
        >>> randprime(1, 30) #doctest: +SKIP
        13
        >>> isprime(randprime(1, 30))
        True

        See Also
        ========

        primerange : Generate all primes in a given range

        References
        ==========

        .. [1] https://en.wikipedia.org/wiki/Bertrand's_postulate

    Nr
   z&no primes exist in the specified range)Úmapr?   r   rz   r–   r/   )r   rI   rA   rL   s       r   Ú	randprimerœ   e  sy   € ð@ 	ˆA‚v€vØˆÝ�s�Q˜�FÑÔ�D€A€qÝ��A‘�qÑÔ€AÝ�!‰Œ€AØˆA‚v€vÝ�a‰LŒLˆØˆ1‚u€uÝÐAÑBÔBÐBØ€Hr   Tc                 ó  — |rt          | ¦  «        } nt          | ¦  «        } | dk     rt          d¦  «        ‚d}|r)t          d| dz   ¦  «        D ]}|t	          |¦  «        z  }Œnt          d| dz   ¦  «        D ]}||z  }Œ|S )a:  
    Returns the product of the first n primes (default) or
    the primes less than or equal to n (when ``nth=False``).

    Examples
    ========

    >>> from sympy.ntheory.generate import primorial, primerange
    >>> from sympy import factorint, Mul, primefactors, sqrt
    >>> primorial(4) # the first 4 primes are 2, 3, 5, 7
    210
    >>> primorial(4, nth=False) # primes <= 4 are 2 and 3
    6
    >>> primorial(1)
    2
    >>> primorial(1, nth=False)
    1
    >>> primorial(sqrt(101), nth=False)
    210

    One can argue that the primes are infinite since if you take
    a set of primes and multiply them together (e.g. the primorial) and
    then add or subtract 1, the result cannot be divided by any of the
    original factors, hence either 1 or more new primes must divide this
    product of primes.

    In this case, the number itself is a new prime:

    >>> factorint(primorial(4) + 1)
    {211: 1}

    In this case two new primes are the factors:

    >>> factorint(primorial(4) - 1)
    {11: 1, 19: 1}

    Here, some primes smaller and larger than the primes multiplied together
    are obtained:

    >>> p = list(primerange(10, 20))
    >>> sorted(set(primefactors(Mul(*p) + 1)).difference(set(p)))
    [2, 5, 31, 149]

    See Also
    ========

    primerange : Generate all primes in a given range

    r
   zprimorial argument must be >= 1r   )r   r?   r/   rG   r4   rS   )rA   r|   rL   r"   s       r   Ú	primorialrž   ‘  sª   € ðd ð Ý�1‰IŒIˆˆå�‰FŒFˆØˆ1‚u€uÝÐ:Ñ;Ô;Ð;Ø	€AØ
ð Ý�q˜!˜a™%‘”ð 	ð 	ˆAØ•�q‘”‰MˆAˆAð	õ ˜A˜q 1™uÑ%Ô%ð 	ð 	ˆAØ�‰FˆAˆAØ€Hr   Fc              #   óº  K  — t          |pd¦  «        }dx}}| | |¦  «        }}d}|r|V — ||k    r@|r||k     r8|dz  }||k    r	|}|dz  }d}|r|V —  | |¦  «        }|dz  }||k    r|¯2||k     °8|r||k    r|rdS |dfV — dS |sRd}	|x}}t          |¦  «        D ]} | |¦  «        }Œ||k    r! | |¦  «        } | |¦  «        }|	dz  }	||k    °!||	fV — dS dS )aw  For a given iterated sequence, return a generator that gives
    the length of the iterated cycle (lambda) and the length of terms
    before the cycle begins (mu); if ``values`` is True then the
    terms of the sequence will be returned instead. The sequence is
    started with value ``x0``.

    Note: more than the first lambda + mu terms may be returned and this
    is the cost of cycle detection with Brent's method; there are, however,
    generally less terms calculated than would have been calculated if the
    proper ending point were determined, e.g. by using Floyd's method.

    >>> from sympy.ntheory.generate import cycle_length

    This will yield successive values of i <-- func(i):

        >>> def gen(func, i):
        ...     while 1:
        ...         yield i
        ...         i = func(i)
        ...

    A function is defined:

        >>> func = lambda i: (i**2 + 1) % 51

    and given a seed of 4 and the mu and lambda terms calculated:

        >>> next(cycle_length(func, 4))
        (6, 3)

    We can see what is meant by looking at the output:

        >>> iter = cycle_length(func, 4, values=True)
        >>> list(iter)
        [4, 17, 35, 2, 5, 26, 14, 44, 50, 2, 5, 26, 14]

    There are 6 repeating values after the first 3.

    If a sequence is suspected of being longer than you might wish, ``nmax``
    can be used to exit early (and mu will be returned as None):

        >>> next(cycle_length(func, 4, nmax = 4))
        (4, None)
        >>> list(cycle_length(func, 4, nmax = 4, values=True))
        [4, 17, 35, 2]

    Code modified from:
        https://en.wikipedia.org/wiki/Cycle_detection.
    r   r
   r   N)r?   rG   )
ÚfÚx0ÚnmaxÚvaluesÚpowerÚlamÚtortoiseÚharer"   Úmus
             r   Úcycle_lengthr©   Ó  s�  è è € õf ˆtˆy�q‰>Œ>€Dð €O€EˆCØ˜˜˜2™œˆd€HØ	€AØð ØˆˆˆØ
�dÒ
Ð
 DÐ
¨A°ªH¨HØ	ˆQ‰ˆØ�CŠ<ˆ<ØˆHØ�Q‰JˆEØˆCØð 	ØˆJˆJˆJØˆq�‰wŒwˆØˆq‰ˆð �dÒ
Ð
 DÐ
¨A°ªH¨Hð ð ��T’	�	Øð 	ØˆFà˜�*ÐÐÐØˆFØð 
àˆØÐˆ�4Ý�s‘”ð 	ð 	ˆAØ�1�T‘7”7ˆDˆDØ˜$ÒÐØ�q˜‘{”{ˆHØ�1�T‘7”7ˆDØ�!‰GˆBð ˜$ÒÐð �2ˆgˆˆˆˆˆð
ð 
r   c           	      óè  — t          | ¦  «        }|dk     rt          d¦  «        ‚g d¢}|dk    r||dz
           S dt          j        d         }}||t	          |¦  «        z
  dz
  k    rN||dz
  k     r/||z   dz	  }|t	          |¦  «        z
  dz
  |k    r|}n|}||dz
  k     °/t          |¦  «        r|dz  }|S ddlm} dd	lm	} d}t          | ||¦  «         | ||¦  «        ¦  «        z   z  ¦  «        }||k     r+||z   dz	  }| ||¦  «        z
  dz
  |k    r|}n|dz   }||k     °+|t	          |¦  «        z
  dz
  }||k    rt          |¦  «        s|dz  }|dz  }||k    °t          |¦  «        r|dz  }|S )
a£   Return the nth composite number, with the composite numbers indexed as
        composite(1) = 4, composite(2) = 6, etc....

        Examples
        ========

        >>> from sympy import composite
        >>> composite(36)
        52
        >>> composite(1)
        4
        >>> composite(17737)
        20000

        See Also
        ========

        sympy.ntheory.primetest.isprime : Test if n is prime
        primerange : Generate all primes in a given range
        primepi : Return the number of primes less than or equal to n
        prime : Return the nth prime
        compositepi : Return the number of positive composite numbers less than or equal to n
    r
   z1nth must be a positive integer; composite(1) == 4)
r!   r   ru   é	   é
   é   é   é   é   é   r¬   r!   r#   r   rq   rs   )r   r/   rv   r,   r{   r   rw   rr   rx   rt   r?   )	r|   rA   Úcomposite_arrr   rI   r}   rr   rt   Ún_compositess	            r   Ú	compositer´   +  só  € õ0 	ˆs‰Œ€AØˆ1‚u€uÝÐLÑMÔMÐMØ8Ð8Ð8€MØˆB‚w€wØ˜Q ™UÔ#Ð#à�eŒk˜"Œo€q€AØˆA•˜‘”‰O˜aÑÒÐØ�!�a‘%ŠiˆiØ�q‘5˜Q‘,ˆCØ•X˜c‘]”]Ñ" QÑ&¨Ò*Ð*Ø��à�ð �!�a‘%Šiˆiõ �1‰:Œ:ð 	Ø�‰FˆAØˆà:Ð:Ð:Ð:Ð:Ð:Ø:Ð:Ð:Ð:Ð:Ð:Ø	€AÝˆAˆsˆs�1‰vŒv˜˜˜C˜C ™FœF™œÑ#Ñ$Ñ%Ô%€Aà
ˆaŠ%ˆ%Ø�1‰u˜‰lˆØ���C‘”‰=˜1Ñ˜qÒ Ð ØˆAˆAà�a‘ˆAð ˆaŠ%ˆ%ð •x ‘{”{‘? QÑ&€LØ
˜Ò
Ð
Ý�q‰zŒzð 	Ø˜AÑˆLØ	ˆQ‰ˆð ˜Ò
Ð
õ ˆq�z„zð Ø	ˆQ‰ˆØ€Hr   c                 óZ   — t          | ¦  «        } | dk     rdS | t          | ¦  «        z
  dz
  S )ak   Return the number of positive composite numbers less than or equal to n.
        The first positive composite is 4, i.e. compositepi(4) = 1.

        Examples
        ========

        >>> from sympy import compositepi
        >>> compositepi(25)
        15
        >>> compositepi(1000)
        831

        See Also
        ========

        sympy.ntheory.primetest.isprime : Test if n is prime
        primerange : Generate all primes in a given range
        prime : Return the nth prime
        primepi : Return the number of primes less than or equal to n
        composite : Return the nth composite number
    r!   r   r
   )r?   r{   )rA   s    r   Úcompositepir¶   l  s2   € õ, 	ˆA‰Œ€AØˆ1‚u€uØˆqØ�x˜‰{Œ{‰?˜QÑÐr   r‡   r%   )T)NF) ro   r   r   Ú	itertoolsr   r   r+   Úsympy.core.randomr   Úsympy.external.gmpyr	   Ú	primetestr   Úsympy.utilities.decoratorr   Úsympy.utilities.miscr   r   r   rv   r4   r�   r?   r{   rz   r–   rS   rœ   rž   r©   r´   r¶   r;   r   r   ú<module>r½      s  ððð ð
 'Ð &Ð &Ð &Ð &Ð &Ð &Ð &Ø Ð Ð Ð Ð Ð ð "Ð !Ð !Ð !Ð !Ð !à %Ð %Ð %Ð %Ð %Ð %Ø $Ð $Ð $Ð $Ð $Ð $Ø Ð Ð Ð Ð Ð Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'ðð ð ðT%ð T%ð T%ð T%ð T%ñ T%ô T%ð T%ðn
 	ˆ‰Œ€ðF1ð F1ð F1ðR €ð kàØBðDñ Dô DðUð Uñ	Dô DðUðp_ˆsð _�sð _ð _ð _ð _ðDPð Pð Pð Pðf,ð ,ð ,ð^fð fð fð fðR)ð )ð )ðX?ð ?ð ?ð ?ðDUð Uð Uð Uðp>ð >ð >ðBð ð ð ð r   