+
    iU                     j    R t ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIH	t	  ! R R]4      t
R tR	 tR
 tR# )z
The Schur number S(k) is the largest integer n for which the interval [1,n]
can be partitioned into k sum-free sets.(https://mathworld.wolfram.com/SchurNumber.html)
N)S)Basic)Function)Integerc                   :   a  ] tR t^t o Rt]R 4       tR tRtV t	R# )SchurNumbera  
This function creates a SchurNumber object
which is evaluated for `k \le 5` otherwise only
the lower bound information can be retrieved.

Examples
========

>>> from sympy.combinatorics.schur_number import SchurNumber

Since S(3) = 13, hence the output is a number
>>> SchurNumber(3)
13

We do not know the Schur number for values greater than 5, hence
only the object is returned
>>> SchurNumber(6)
SchurNumber(6)

Now, the lower bound information can be retrieved using lower_bound()
method
>>> SchurNumber(6).lower_bound()
536

c           
     `   VP                   '       d   V\        P                  J d   \        P                  # VP                  '       d   \        P                  # VP
                  '       d   VP                  '       d   \        R 4      h^^^^^^^^,^^/pV^8:  d   \        W!,          4      # R# R# )zk should be a positive integerN)		is_Numberr   Infinityis_zeroZero
is_integeris_negative
ValueErrorr   )clskfirst_known_schur_numberss   && ^/var/www/html/photoedit/myenv/lib/python3.14/site-packages/sympy/combinatorics/schur_number.pyevalSchurNumber.eval'   s    ;;;AJJzz!yyyvv<<<1=== !ABB)*Aq!QAr1c(J%Av8;<<      c                *   V P                   ^ ,          pV^8X  d   \        R4      # V^8X  d   \        R4      # VP                  '       d5   ^V P                  V^,
          4      P	                  4       ,          ^,
          # ^V,          ^,
          ^,          # )    i  i  )argsr   
is_Integerfunclower_bound)selff_s   & r   r   SchurNumber.lower_bound4   sr    YYq\73<74= ===TYYrAv&2244q882	1}r    N)
__name__
__module____qualname____firstlineno____doc__classmethodr   r   __static_attributes____classdictcell__)__classdict__s   @r   r   r      s(     4 
= 
=
 
r   r   c                     V \         P                  J d   \        R 4      hV ^ 8:  d   \        R4      hV ^8:  d   ^pM9\        P                  ! \        P
                  ! ^V ,          ^,           ^4      4      p\        V4      # )zInput must be finitez&n must be a non-zero positive integer.)r   r
   r   mathceillogr   )nmin_ks   & r   _schur_subsets_numberr0   A   sc    AJJ/00AvABB	
a		$((1Q37A./5>r   c                   \        V \        4      '       d   V P                  '       g   \        R4      h\	        V 4      pV ^8X  d   ^..pM"V ^8X  d   ^^..pMV ^8X  d   . RO.pM^^.^^..p\        V4      V8  dj   \        W 4      p\        \        V4      V ^,
          ^,          ^,           4       Uu. uF  p^V,          ^,           NK  	  ppVR;;,          V,          uu&   Ky  V# u upi )a  

This function returns the partition in the minimum number of sum-free subsets
according to the lower bound given by the Schur Number.

Parameters
==========

n: a number
    n is the upper limit of the range [1, n] for which we need to find and
    return the minimum number of free subsets according to the lower bound
    of schur number

Returns
=======

List of lists
    List of the minimum number of sum-free subsets

Notes
=====

It is possible for some n to make the partition into less
subsets since the only known Schur numbers are:
S(1) = 1, S(2) = 4, S(3) = 13, S(4) = 44.
e.g for n = 44 the lower bound from the function above is 5 subsets but it has been proven
that can be done with 4 subsets.

Examples
========

For n = 1, 2, 3 the answer is the set itself

>>> from sympy.combinatorics.schur_number import schur_partition
>>> schur_partition(2)
[[1, 2]]

For n > 3, the answer is the minimum number of sum-free subsets:

>>> schur_partition(5)
[[3, 2], [5], [1, 4]]

>>> schur_partition(8)
[[3, 2], [6, 5, 8], [1, 4, 7]]
zInput value must be a number)         )
isinstancer   r	   r   r0   len_generate_next_listrange)r.   number_of_subsetssum_free_subsetsr   missed_elementss   &    r   schur_partitionr=   O   s    ^ !UAKKK788-a0AvC5	
aF8	
a%;FQF+

"3
3./?C,1#6F2G!A#PQTU,VW,Vq1Q377,VW/ Xs   4C(c                    . pV  Fx  pV Uu. uF  qD^,          V8:  g   K  V^,          NK  	  ppV Uu. uF)  qD^,          ^,
          V8:  g   K  V^,          ^,
          NK+  	  ppWV,           pVP                  V4       Kz  	  \        \        V 4      ^,           4       Uu. uF*  p^V,          ^,           V8:  g   K  ^V,          ^,           NK,  	  p	pVP                  V	4       Tp V # u upi u upi u upi )r4   )appendr9   r7   )
current_listr.   new_listitemnumbertemp_1temp_2new_itemr   	last_lists
   &&        r   r8   r8      s    H)-?vQ(&((?-1GT6AX\Q5F,&(Q,,TG?!	  #(L(9!(;"<M"<Q!a11q"<IMOOIL @G Ns!   C%C%C*C*C/:C/)r%   r+   
sympy.corer   sympy.core.basicr   sympy.core.functionr   sympy.core.numbersr   r   r0   r=   r8   r    r   r   <module>rL      s9      " ( &2( 2jAHr   