+
    ‹°³jÑ  ã                   ó0   € ^ RI Ht R tR tR t]3R ltR# )é    )Úas_intc                óâ   € \        V 4      p ^ V 3^V ^ 3^/p^p\        ^V ^,          ^,           4       F9  pW V,
          ^,           ,          V,          pV;WW,
          3&   WV,
          V3&   K;  	  V# )a¦  Return a dictionary containing pairs :math:`{(k1,k2) : C_kn}` where
:math:`C_kn` are binomial coefficients and :math:`n=k1+k2`.

Examples
========

>>> from sympy.ntheory import binomial_coefficients
>>> binomial_coefficients(9)
{(0, 9): 1, (1, 8): 9, (2, 7): 36, (3, 6): 84,
 (4, 5): 126, (5, 4): 126, (6, 3): 84, (7, 2): 36, (8, 1): 9, (9, 0): 1}

See Also
========

binomial_coefficients_list, multinomial_coefficients
©r   Úrange©ÚnÚdÚaÚks   &   ÚZ/home/luca/screen-checking/.venv/lib/python3.14/site-packages/sympy/ntheory/multinomial.pyÚbinomial_coefficientsr      sx   € ô" 	ˆq‹	€AØ
ˆQˆ��Q˜�F˜AÐ€AØ	€AÜ�1�a˜•d˜Q•hÖˆØ�a•%˜!•)�_˜qÕ ˆØ$%Ð%ˆˆQ�Uˆ(‰�a˜A�˜q˜“kñ  ð €Hó    c                óÜ   € \        V 4      p ^.V ^,           ,          p^p\        ^V ^,          ^,           4       F/  pW V,
          ^,           ,          V,          pV;W&   WV,
          &   K1  	  V# )a#  Return a list of binomial coefficients as rows of the Pascal's
triangle.

Examples
========

>>> from sympy.ntheory import binomial_coefficients_list
>>> binomial_coefficients_list(9)
[1, 9, 36, 84, 126, 126, 84, 36, 9, 1]

See Also
========

binomial_coefficients, multinomial_coefficients
r   r   s   &   r   Úbinomial_coefficients_listr      sg   € ô  	ˆq‹	€AØ	
ˆˆq�1�u�€AØ	€AÜ�1�a˜•d˜Q•hÖˆØ�a•%˜!•)�_˜qÕ ˆØÐˆ‰ˆq�Q•‹xñ  ð €Hr   c                óŒ  € \        V 4      p \        V4      pV '       g   V'       d   / # R^/# V ^8X  d   \        V4      # V ^V,          8¼  d   V^8”  d   \        \        W4      4      # V.^ .V ^,
          ,          ,           p\	        V4      ^/pV'       d   ^ pMT pW@^,
          8  Ed   W$,          pV'       d	   ^ W$&   WR^ &   V^8”  d#   W$^,           ;;,          ^,          uu&   ^ p^p^ pM8V^,          pV^,           pV\	        V4      ,          pW$;;,          ^,          uu&   \        W`4       FS  pW(,          '       g   K  W(;;,          ^,          uu&   Ws\	        V4      ,          ,          pW(;;,          ^,          uu&   KU  	  V^ ;;,          ^,          uu&   Wu,          W^ ,          ,
          ,          V\	        V4      &   EK)  V# )a¬  Return a dictionary containing pairs ``{(k1,k2,..,km) : C_kn}``
where ``C_kn`` are multinomial coefficients such that
``n=k1+k2+..+km``.

Examples
========

>>> from sympy.ntheory import multinomial_coefficients
>>> multinomial_coefficients(2, 5) # indirect doctest
{(0, 5): 1, (1, 4): 5, (2, 3): 10, (3, 2): 10, (4, 1): 5, (5, 0): 1}

Notes
=====

The algorithm is based on the following result:

.. math::
    \binom{n}{k_1, \ldots, k_m} =
    \frac{k_1 + 1}{n - k_1} \sum_{i=2}^m \binom{n}{k_1 + 1, \ldots, k_i - 1, \ldots}

Code contributed to Sage by Yann Laigle-Chapuy, copied with permission
of the author.

See Also
========

binomial_coefficients_list, binomial_coefficients
© )r   r   ÚdictÚ!multinomial_coefficients_iteratorÚtupler   )	Úmr   ÚtÚrÚjÚtjÚstartÚvr   s	   &&       r   Úmultinomial_coefficientsr   7   si  € ô: 	ˆq‹	€AÜˆq‹	€AßßØˆIØ�AˆwˆØˆA„vÜ$ QÓ'Ð'ØˆAˆa�C„x�A˜”EÜÔ5°aÓ;Ó<Ð<Ø	
ˆˆqˆc�Q˜•U�mÕ€AÜ	ˆq‹�1ˆ€AßØ‰àˆà
�!�e�)à�TˆßØˆA‰DØˆa‰DØ�Œ6Ø�!�e�H˜�M‹HØˆAØˆEØ‰Aà��FˆAØ˜•EˆEØ”%˜“(•ˆAØ�D�A�I‹Dô �u–ˆAØ�tŽtØ—˜•	“Ø”u˜Q“x•[Õ �Ø—˜•	•ñ	 !ð
 	
ˆ!���	‹Ø•v 1¨¥t¥8Õ,ˆŒ%�‹(ŒØ€Hr   c           	   #  ó  "  € \        V 4      p \        V4      pV ^V,          8  g   V^8X  d&   \        W4      pVP                  4        Rj  x€L
  R# \        W4      p/ pVP                  4        F  w  rVWdV! \        RV4      4      &   K  	  TpV.^ .V ^,
          ,          ,           pV! V4      pV! \        RV4      4      p	WƒV	,          3x € V'       d   ^ p
MT p
W ^,
          8  d˜   Wz,          pV
'       d	   ^ Wz&   W·^ &   V^8”  d   Wz^,           ;;,          ^,          uu&   ^ p
MV
^,          p
Wz;;,          ^,          uu&   V^ ;;,          ^,          uu&   V! V4      pV! \        RV4      4      p	WƒV	,          3x € K¤  R#  EL55i)a1  multinomial coefficient iterator

This routine has been optimized for `m` large with respect to `n` by taking
advantage of the fact that when the monomial tuples `t` are stripped of
zeros, their coefficient is the same as that of the monomial tuples from
``multinomial_coefficients(n, n)``. Therefore, the latter coefficients are
precomputed to save memory and time.

>>> from sympy.ntheory.multinomial import multinomial_coefficients
>>> m53, m33 = multinomial_coefficients(5,3), multinomial_coefficients(3,3)
>>> m53[(0,0,0,1,2)] == m53[(0,0,1,0,2)] == m53[(1,0,2,0,0)] == m33[(0,1,2)]
True

Examples
========

>>> from sympy.ntheory.multinomial import multinomial_coefficients_iterator
>>> it = multinomial_coefficients_iterator(20,3)
>>> next(it)
((3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), 1)
N)r   r   ÚitemsÚfilter)r   r   Ú_tupleÚmcÚmc1r   r   r   Út1Úbr   r   s   &&&         r   r   r   �   sR  é € ô, 	ˆq‹	€AÜˆq‹	€AØˆ1ˆQ�3„w�!�q”&Ü% aÓ+ˆØ—8‘8“:×Òä% aÓ+ˆØˆØ—H‘H–J‰DˆAØ+,‘”v˜d A“Ó'Ó(ñ àˆàˆC�1�#˜˜Q�•-ÕˆÙ�A‹YˆÙ”6˜$ Ó#Ó$ˆØ�a•5ˆkÒßØ‰AàˆAà�a•%Œià•ˆBßØ�‘Ø�!‘Ø�AŒvØ�a•%—˜A•“Ø‘à�Q•�Ø—˜•	“àˆa�D�A�I‹DÙ˜“ˆBÙ”v˜d BÓ'Ó(ˆAØ˜!•u�+Ôñ! ò# 	ùs   ‚A
FÁFÁD5FN)Úsympy.utilities.miscr   r   r   r   r   r   r   r   r   Ú<module>r'      s#   ðÝ 'òò4ò2GðT 49ö ;r   