+
    i.                         ^ RI Ht R tR tR# )    wrapsc                   a V oV3R lpV# )a  
Memo decorator for sequences defined by recurrence

Examples
========

>>> from sympy.utilities.memoization import recurrence_memo
>>> @recurrence_memo([1]) # 0! = 1
... def factorial(n, prev):
...     return n * prev[-1]
>>> factorial(4)
24
>>> factorial(3) # use cache values
6
>>> factorial.cache_length() # cache length can be obtained
5
>>> factorial.fetch_item(slice(2, 4))
[2, 6]

c                 `   <a  \        S 4      VV 3R  l4       pV3R lVn        V3R lVn        V# )c                    < \        S4      pW8  d
   SV ,          # \        W^,           4       F  pSP                  S! VS4      4       K  	  SR,          # )   lenrangeappend)nLicachefs   &  {/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/sympy/utilities/memoization.pyg-recurrence_memo.<locals>.decorator.<locals>.g   sH    E
AuQx1!e_Qq%[) %9    c                     < \        S 4      # N)r   )r   s   r   <lambda>4recurrence_memo.<locals>.decorator.<locals>.<lambda>$   s	    Ur   c                    < SV ,          # r    )xr   s   &r   r   r   %   s	    qr   )r   cache_length
fetch_item)r   r   r   s   f r   	decorator"recurrence_memo.<locals>.decorator   s.    	q	 
	 ,)r   r   )initialr    r   s   & @r   recurrence_memor#      s    * E r   c                   a a . oV V3R lpV# )z
Memo decorator for associated sequences defined by recurrence starting from base

base_seq(n) -- callable to get base sequence elements

XXX works only for Pn0 = base_seq(0) cases
XXX works only for m <= n cases
c                 6   <a  \        S 4      VVV 3R  l4       pV# )c                 8  < \        S	4      pW8  d   S	V ,          V,          # \        W ^,           4       FS  pS! V4      pV.pS	P                  V4       \        ^V^,           4       F  pS
! W6S	4      pVP                  V4       K  	  KU  	  S	V ,          V,          # )r   r
   )r   mr   r   F_i0	F_i_cachejF_ijbase_seqr   r   s   &&      r   r   3assoc_recurrence_memo.<locals>.decorator.<locals>.g7   s    E
AuQx{"1!e_{!F	Y' q!a%AQ5>D$$T* ) % 8A;r   r   )r   r   r,   r   s   f r   r    (assoc_recurrence_memo.<locals>.decorator6   s     	q	 
	& r   r   )r,   r    r   s   f @r   assoc_recurrence_memor/   *   s     E, r   N)	functoolsr   r#   r/   r   r   r   <module>r1      s    #L"r   