+
    i##                         ^ RI HtHtHtHtHtHtHtHtH	t	H
t
HtHtHtHtHtHt ^RIHtHt ^ RIHt ^ RIHt ^ RIt^ RIHt R tR tR	 t]! ^^.4      R
 R l4       tR R lt]! RRRR7      RR l4       t R# )    )fzerofrom_intfrom_rationalfonefhalfbitcountto_intmpf_mulmpf_divmpf_submpf_addmpf_sqrtmpf_pimpf_cosh_sinhmpf_cosmpf_sin)_sqrt_mod_prime_poweris_quad_residue)
deprecated)recurrence_memoNcountc                  `   Rp ^ .V ,          s ^.V ,          s\        V R,          4      ^,           p\        ^V4       FM  p\         V,          ^ 8X  g   K  \        W",          W4       F   p\         V,          ^ 8X  g   K  V\         V&   K"  	  KO  	  \        ^V 4       F  p\         V,          ^ 8X  d   V\         V&   V^,
          \        V&   K0  \         V,          pW$,          pWT,          ^ 8X  d   \        V,          V,          \        V&   Ko  \        V,          V^,
          ,          \        V&   K  	  R# )
         ?N順 )_factor_totientintrange)maxnlimijxys         W/var/www/html/photoedit/myenv/lib/python3.14/site-packages/sympy/ntheory/partitions_.py_prer(      s    Dc$hGs4xH
dCi.1
C1c]1:?13(1:?!"GAJ ) 
 1d^1:?GAJA#HQKAJD5A:"1+a-HQK"1+q1u-HQK     c                J   V^8X  d   \         # Tp^ p\        V,          pW5,          ^ 8X  d   W5,          pV^,          pK   W,          p^^V ,          ,
          p\        V4      pV^8X  Ed0   V^8X  d   ^V,          p	WV	,          ,           pV\        ^	V^,
          V	4      ,          V	,          p\	        V^V^,           4      ^ ,          p
\        \        \        ^V
,          4      W4      \        V	4      V4      p\        \        \        RV,          ^V
^,          ,
          ,          4      \        \        V4      V4      V4      \        W4      V4      # V^8X  Ed	   ^V,          p	WV	,          ,           pV^8  d*   V\        ^@V^,          ^,
          V	4      ,          V	,          p\	        V^V^,           4      ^ ,          p
\        \        \        ^V
,          4      W4      \        V	4      V4      p\        \        \        ^RV^,           ,          ,          ^^V
^,          ,          ,
          ,          4      \        \        V^,          4      V4      V4      \        W4      V4      # WV,          ,           pV^,          R9   d   RM^pWu,          ^ 8X  d7   V^8X  d*   \        \        V4      \        \        V4      V4      V4      # \        # \        Wu4      '       g   \        # WT^,
          ,          V^,
          ,          pV\        RV^,
          V4      ,          p\	        WuV4      ^ ,          p
\        \        \        ^V
,          4      W4      \        V4      V4      p\        \        \        ^V,          4      \        \        V4      V4      V4      \        W4      V4      # V^8w  g	   V^8  Ed2   \        P                  ! V^4      \        P                  ! V^4      r^W,          ,          pW,          V ,          V^,          ^,
          V,          ,           \        WF,          V,          V,          \        V,          ^,
          V4      ,          V,          pW,          V ,          V^,          ^,
          V,          ,           \        WC,          V,          V,          \        V,          ^,
          V4      ,          V,          p\        \!        VW24      \!        VWb4      V4      # V^8X  d   ^V ,          ^,           \        ^\        V,          ^,
          V4      ,          V,          p^V ^,
          V^,          ^,
          ^,          ,
          V^,          ,          ^,          ,           ^,          p\        \        \        R4      \!        VW24      V4      \!        VWb4      4      # ^V ,          ^,           \        ^ \        V,          ^,
          V4      ,          V,          p^W^,          ^,
          ^,          ,
          ^,          ,           ^,          p\        \!        VW24      \!        VWb4      V4      # )z{Compute the inner sum in HRR formula [1]_

References
==========

.. [1] https://msp.org/pjm/1956/6-1/pjm-v6-n1-p18-p.pdf

i@  )      )r   r   r   powr   r   r
   r   r   r   r   r   r   mathgcdr   _a)nkpreck1epk2vpimodmargjacobi3_phid1d2n1n2s   &&&               r'   r1   r1   "   s    	Av	
B	A
A
&A+
	Q	
B	BqDA	B	Qw6A#C#gA3q!a%%%,A%aAE215A'1r)*23-?C7"q!q1u+./!d+T3 "D* * 6A#C#gA1us2q!tax--4%aAE215A'(1Q3-:t%C7B!a%=!aQi-89!Q$.6 "D* * AIB&("a5A:AvW%Xa[$/7 7 Lq$$Lq5z1q5!s3q!$$!!*1-HQqSM2,QK wQwYXa[$'/ C& 	&
 	Ava"b!488B#3BKtAvQR'R
HRL1,b12578tAvQR'R
HRL1,b12578r"b'B)94@@AvsQwC"!1266"<AERUQYN*RU3q88A=wRLr2d$ r2 	 Q37CHRL1,b1
1R	7B
qEAI>!Q&
&!	+B2b"#RB%5t<<r)   c           	     t   \        V4      p\        V4      p\        W1V4      p\        \        V 4      \	        ^^V4      V4      p\        Wr4      p\        \        Wh4      V4      w  r\        \        W4      \        \        WG4      V4      V4      p\        \        Wi4      \        WV4      V4      p\        W4      # )zx
Compute the sinh term in the outer sum of the HRR formula.
The constants sqrt(2/3*pi) and sqrt(8) must be precomputed.
)r   r   r   r   r   r   r   r
   )r2   r$   r4   sq23pisqrt8r:   abcchshDEs   &&&&&        r'   _drN   y   s    
 	A	B4 A]1b$7>AA71=$/FB!2&	.A 	t 4d;A1=r)   c                0    V ^8  d   QhR\         R\         /#    r2   returnr   )formats   "r'   __annotate__rU      s      c C r)   c                   ^ p^ p\        4        Fs  pV^V,          ^,           ,          pW,
          pV^ 8  d    V# W,          pWT^,           ,          p^ V8:  d   WaV,          ,          pY$^,          '       d   V) MT,          pKu  	  V# )z_Calculate the partition function P(n)

Parameters
==========

n : int
    nonnegative integer

r   )r2   prevr9   pentar#   npss   &&     r'   _partition_recr[      s     	
AEW1qY6 H H
!e7bMA	q55aRa  Hr)   c                0    V ^8  d   QhR\         R\         /# rP   rS   )rT   s   "r'   rU   rU      s     J0 J0# J0# J0r)   c           	       aaa V ^ 8  d   ^ # V R8:  d!   V \         P                  4       ,
          ^F8  g!   \         P                  4       ^8X  d   V R8  d   \        V 4      # R\        4       9  d   \        4        \	        \
        P                  ^V ,          R,          R,          ,          \
        P                  ! ^V ,          4      ,
          \
        P                  ! ^
4      ,          ^,           4      \
        P                  ! ^
4      ,          p\	        VR,          ^d,           4      ;r#^,\
        P                  ^,          ,          ^\
        P                  ! ^4      ,          ,          o\
        P                  \
        P                  ! ^4      ,          ^K,          o\
        P                  \
        P                  ! R	4      ,          oVVV3R lp\        ^	\
        P                  ! V R,          4      4      pV! W4      R8  g   Q hV^(8  d   V! W4      R8  d   V^,          pK  TpV^,          pWV,
          ^8  d0   WV,           ^,          pV! W4      ;pR8  d   TpK/  VR8  g   K8  TpK<  Tp	V	R
8  d   \        R4      h\        p
\        \        \!        ^^V4      V4      \#        V4      V4      p\        \%        ^4      V4      p\'        ^V	4       FV  p\)        WV4      p\+        WW;V4      p\-        V
\        W4      V4      p
\/        \1        \3        V4      4      4      ^2,           pKX  	  \	        \3        \-        V
\4        V4      4      4      # )zGCalculate the partition function P(n)

Parameters
==========

n : int

i@ i@8  r   g      @r   g?c                    < \         P                  pSV! V4      ,          SV! W^,
          ,          4      ,          \         P                  ! SV! V 4      ,          V,          4      ,          ,           # )   )r/   sqrtsinh)r2   Nr`   c1c2c3s   && r'   _M_partition.<locals>._M   sH    yy$q'zBtA1uI.tyyDGA/FFFFr)   zInput too biggUUUUUU?r   )r[   cache_lengthglobalsr(   r   r/   r:   loglog2r`   maxceil
ValueErrorr   r
   r   r   r   r   r    r1   rN   r   r   absr	   r   )r2   pbitsr4   r7   rf   bigsmallrb   erMrZ   rE   rF   qrG   drc   rd   re   s   &               @@@r'   
_partitionrw      s~    	1u	W^88::R?'')Q.1v: a  	!1R#1	xx|$&'( ) 			"E 59s?##D
 
DGGQJDIIaL(	)B	1	b	 B	3	BG a1c6"
#Ca:
(r!zC'	E
'C
+/[1Q(NBc!C3YEA 	5y)) 	AXmAq!4a8&)QGFXa[!$E1a[qQKqQ&Awq}d+ S^$r)  vga-.//r)   zpThe `sympy.ntheory.partitions_.npartitions` has been moved to `sympy.functions.combinatorial.numbers.partition`.z1.13z%deprecated-ntheory-symbolic-functions)deprecated_since_versionactive_deprecations_targetc                    ^ RI Hp V! V 4      # )a  
Calculate the partition function P(n), i.e. the number of ways that
n can be written as a sum of positive integers.

.. deprecated:: 1.13

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

P(n) is computed using the Hardy-Ramanujan-Rademacher formula [1]_.


The correctness of this implementation has been tested through $10^{10}$.

Examples
========

>>> from sympy.functions.combinatorial.numbers import partition
>>> partition(25)
1958

References
==========

.. [1] https://mathworld.wolfram.com/PartitionFunctionP.html

)	partition)%sympy.functions.combinatorial.numbersr{   )r2   verbosefunc_partitions   && r'   npartitionsr      s    B R!r)   )F)!mpmath.libmpr   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   residue_ntheoryr   r   sympy.utilities.decoratorr   sympy.utilities.memoizationr   r/   	itertoolsr   r(   r1   rN   r[   rw   r    r)   r'   <module>r      s   @ @ @ @ @ D 0 7  ..U=n$ !Q 4J0Z  tBD	Dr)   