



'''simple docstring'''
from typing import Optional, Tuple, Union

import flax
import flax.linen as nn
import jax
import jax.numpy as jnp
from flax.core.frozen_dict import FrozenDict

from ..configuration_utils import ConfigMixin, flax_register_to_config
from ..utils import BaseOutput
from .embeddings_flax import FlaxTimestepEmbedding, FlaxTimesteps
from .modeling_flax_utils import FlaxModelMixin
from .unet_ad_blocks_flax import (
    FlaxCrossAttnDownBlockaD,
    FlaxDownBlockaD,
    FlaxUNetMidBlockaDCrossAttn,
)






@flax.struct.dataclass
class 							lowercase__	(							lowercase   ):
	lowercase__  				=			42
	lowercase__  				=			42






class 							lowercase__	(							nn.Module   ):
	lowercase__  				=			42
	lowercase__  				=			(16, 32, 96, 2_56)
	lowercase__  				=			jnp.floataa





	def 	UpperCamelCase_  ( self					:				Tuple ):







							'''simple docstring'''
							_UpperCamelCase					:		List[str] 				=   nn.Conv(
							    self.block_out_channels[0] ,kernel_size=(3, 3) ,padding=((1, 1), (1, 1)) ,dtype=self.dtype ,)

							_UpperCamelCase					:		List[Any] 				=   []
							for i in range(len(self.block_out_channels ) - 1 ):
													_UpperCamelCase					:		Optional[int] 				=   self.block_out_channels[i]
													_UpperCamelCase					:		List[Any] 				=   self.block_out_channels[i + 1]
													_UpperCamelCase					:		int 				=   nn.Conv(
													    lowerCamelCase__ ,kernel_size=(3, 3) ,padding=((1, 1), (1, 1)) ,dtype=self.dtype ,)
													blocks.append(lowerCamelCase__ )
													_UpperCamelCase					:		Union[str, Any] 				=   nn.Conv(
													    lowerCamelCase__ ,kernel_size=(3, 3) ,strides=(2, 2) ,padding=((1, 1), (1, 1)) ,dtype=self.dtype ,)
													blocks.append(lowerCamelCase__ )
							_UpperCamelCase					:		Any 				=   blocks

							_UpperCamelCase					:		List[str] 				=   nn.Conv(
							    self.conditioning_embedding_channels ,kernel_size=(3, 3) ,padding=((1, 1), (1, 1)) ,kernel_init=nn.initializers.zeros_init() ,bias_init=nn.initializers.zeros_init() ,dtype=self.dtype ,)





	def __call__( self					:				List[Any] ,lowerCamelCase__					:				Tuple ):







							'''simple docstring'''
							_UpperCamelCase					:		Optional[Any] 				=   self.conv_in(lowerCamelCase__ )
							_UpperCamelCase					:		List[Any] 				=   nn.silu(lowerCamelCase__ )

							for block in self.blocks:
													_UpperCamelCase					:		List[str] 				=   block(lowerCamelCase__ )
													_UpperCamelCase					:		Dict 				=   nn.silu(lowerCamelCase__ )

							_UpperCamelCase					:		List[str] 				=   self.conv_out(lowerCamelCase__ )

							return embedding






@flax_register_to_config
class 							lowercase__	(							nn.Module						,					lowercase						,					lowercase   ):
	lowercase__  				=			32
	lowercase__  				=			4
	lowercase__  				=			(
	    "CrossAttnDownBlock2D",
	    "CrossAttnDownBlock2D",
	    "CrossAttnDownBlock2D",
	    "DownBlock2D",
	)
	lowercase__  				=			False
	lowercase__  				=			(3_20, 6_40, 12_80, 12_80)
	lowercase__  				=			2
	lowercase__  				=			8
	lowercase__  				=			None
	lowercase__  				=			12_80
	lowercase__  				=			0.0
	lowercase__  				=			False
	lowercase__  				=			jnp.floataa
	lowercase__  				=			True
	lowercase__  				=			0
	lowercase__  				=			"rgb"
	lowercase__  				=			(16, 32, 96, 2_56)





	def 	UpperCamelCase_  ( self					:				List[Any] ,lowerCamelCase__					:				jax.random.KeyArray ):







							'''simple docstring'''
							# init input tensors
							_UpperCamelCase					:		Optional[Any] 				=   (1, self.in_channels, self.sample_size, self.sample_size)
							_UpperCamelCase					:		Tuple 				=   jnp.zeros(lowerCamelCase__ ,dtype=jnp.floataa )
							_UpperCamelCase					:		Optional[int] 				=   jnp.ones((1,) ,dtype=jnp.intaa )
							_UpperCamelCase					:		Any 				=   jnp.zeros((1, 1, self.cross_attention_dim) ,dtype=jnp.floataa )
							_UpperCamelCase					:		Tuple 				=   (1, 3, self.sample_size * 8, self.sample_size * 8)
							_UpperCamelCase					:		Union[str, Any] 				=   jnp.zeros(lowerCamelCase__ ,dtype=jnp.floataa )

							_UpperCamelCase				,			_UpperCamelCase					:		Optional[int] 				=   jax.random.split(lowerCamelCase__ )
							_UpperCamelCase					:		Optional[Any] 				=   {'params': params_rng, 'dropout': dropout_rng}

							return self.init(lowerCamelCase__ ,lowerCamelCase__ ,lowerCamelCase__ ,lowerCamelCase__ ,lowerCamelCase__ )["params"]





	def 	UpperCamelCase_  ( self					:				Optional[int] ):







							'''simple docstring'''
							_UpperCamelCase					:		Union[str, Any] 				=   self.block_out_channels
							_UpperCamelCase					:		Optional[int] 				=   block_out_channels[0] * 4

							# If `num_attention_heads` is not defined (which is the case for most models)
							# it will default to `attention_head_dim`. This looks weird upon first reading it and it is.
							# The reason for this behavior is to correct for incorrectly named variables that were introduced
							# when this library was created. The incorrect naming was only discovered much later in https://github.com/huggingface/diffusers/issues/2011#issuecomment-1547958131
							# Changing `attention_head_dim` to `num_attention_heads` for 40,000+ configurations is too backwards breaking
							# which is why we correct for the naming here.
							_UpperCamelCase					:		Dict 				=   self.num_attention_heads or self.attention_head_dim

							# input
							_UpperCamelCase					:		Optional[int] 				=   nn.Conv(
							    block_out_channels[0] ,kernel_size=(3, 3) ,strides=(1, 1) ,padding=((1, 1), (1, 1)) ,dtype=self.dtype ,)

							# time
							_UpperCamelCase					:		Union[str, Any] 				=   FlaxTimesteps(
							    block_out_channels[0] ,flip_sin_to_cos=self.flip_sin_to_cos ,freq_shift=self.config.freq_shift )
							_UpperCamelCase					:		List[Any] 				=   FlaxTimestepEmbedding(lowerCamelCase__ ,dtype=self.dtype )

							_UpperCamelCase					:		str 				=   FlaxControlNetConditioningEmbedding(
							    conditioning_embedding_channels=block_out_channels[0] ,block_out_channels=self.conditioning_embedding_out_channels ,)

							_UpperCamelCase					:		Tuple 				=   self.only_cross_attention
							if isinstance(lowerCamelCase__ ,lowerCamelCase__ ):
													_UpperCamelCase					:		int 				=   (only_cross_attention,) * len(self.down_block_types )

							if isinstance(lowerCamelCase__ ,lowerCamelCase__ ):
													_UpperCamelCase					:		List[str] 				=   (num_attention_heads,) * len(self.down_block_types )

							# down
							_UpperCamelCase					:		List[Any] 				=   []
							_UpperCamelCase					:		Union[str, Any] 				=   []

							_UpperCamelCase					:		Dict 				=   block_out_channels[0]

							_UpperCamelCase					:		int 				=   nn.Conv(
							    lowerCamelCase__ ,kernel_size=(1, 1) ,padding='VALID' ,kernel_init=nn.initializers.zeros_init() ,bias_init=nn.initializers.zeros_init() ,dtype=self.dtype ,)
							controlnet_down_blocks.append(lowerCamelCase__ )

							for i, down_block_type in enumerate(self.down_block_types ):
													_UpperCamelCase					:		Dict 				=   output_channel
													_UpperCamelCase					:		List[Any] 				=   block_out_channels[i]
													_UpperCamelCase					:		Any 				=   i == len(lowerCamelCase__ ) - 1

													if down_block_type == "CrossAttnDownBlock2D":
																			_UpperCamelCase					:		Any 				=   FlaxCrossAttnDownBlockaD(
																			    in_channels=lowerCamelCase__ ,out_channels=lowerCamelCase__ ,dropout=self.dropout ,num_layers=self.layers_per_block ,num_attention_heads=num_attention_heads[i] ,add_downsample=not is_final_block ,use_linear_projection=self.use_linear_projection ,only_cross_attention=only_cross_attention[i] ,dtype=self.dtype ,)
													else:
																			_UpperCamelCase					:		Dict 				=   FlaxDownBlockaD(
																			    in_channels=lowerCamelCase__ ,out_channels=lowerCamelCase__ ,dropout=self.dropout ,num_layers=self.layers_per_block ,add_downsample=not is_final_block ,dtype=self.dtype ,)

													down_blocks.append(lowerCamelCase__ )

													for _ in range(self.layers_per_block ):
																			_UpperCamelCase					:		Any 				=   nn.Conv(
																			    lowerCamelCase__ ,kernel_size=(1, 1) ,padding='VALID' ,kernel_init=nn.initializers.zeros_init() ,bias_init=nn.initializers.zeros_init() ,dtype=self.dtype ,)
																			controlnet_down_blocks.append(lowerCamelCase__ )

													if not is_final_block:
																			_UpperCamelCase					:		List[Any] 				=   nn.Conv(
																			    lowerCamelCase__ ,kernel_size=(1, 1) ,padding='VALID' ,kernel_init=nn.initializers.zeros_init() ,bias_init=nn.initializers.zeros_init() ,dtype=self.dtype ,)
																			controlnet_down_blocks.append(lowerCamelCase__ )

							_UpperCamelCase					:		Optional[Any] 				=   down_blocks
							_UpperCamelCase					:		List[str] 				=   controlnet_down_blocks

							# mid
							_UpperCamelCase					:		Any 				=   block_out_channels[-1]
							_UpperCamelCase					:		Tuple 				=   FlaxUNetMidBlockaDCrossAttn(
							    in_channels=lowerCamelCase__ ,dropout=self.dropout ,num_attention_heads=num_attention_heads[-1] ,use_linear_projection=self.use_linear_projection ,dtype=self.dtype ,)

							_UpperCamelCase					:		Any 				=   nn.Conv(
							    lowerCamelCase__ ,kernel_size=(1, 1) ,padding='VALID' ,kernel_init=nn.initializers.zeros_init() ,bias_init=nn.initializers.zeros_init() ,dtype=self.dtype ,)





	def __call__( self					:				int ,lowerCamelCase__					:				Union[str, Any] ,lowerCamelCase__					:				Optional[int] ,lowerCamelCase__					:				int ,lowerCamelCase__					:				str ,lowerCamelCase__					:				float = 1.0 ,lowerCamelCase__					:				bool = True ,lowerCamelCase__					:				bool = False ,):







							'''simple docstring'''
							_UpperCamelCase					:		Any 				=   self.controlnet_conditioning_channel_order
							if channel_order == "bgr":
													_UpperCamelCase					:		Optional[Any] 				=   jnp.flip(lowerCamelCase__ ,axis=1 )

							# 1. time
							if not isinstance(lowerCamelCase__ ,jnp.ndarray ):
													_UpperCamelCase					:		Tuple 				=   jnp.array([timesteps] ,dtype=jnp.intaa )
							elif isinstance(lowerCamelCase__ ,jnp.ndarray ) and len(timesteps.shape ) == 0:
													_UpperCamelCase					:		Optional[Any] 				=   timesteps.astype(dtype=jnp.floataa )
													_UpperCamelCase					:		List[str] 				=   jnp.expand_dims(lowerCamelCase__ ,0 )

							_UpperCamelCase					:		Any 				=   self.time_proj(lowerCamelCase__ )
							_UpperCamelCase					:		Dict 				=   self.time_embedding(lowerCamelCase__ )

							# 2. pre-process
							_UpperCamelCase					:		List[Any] 				=   jnp.transpose(lowerCamelCase__ ,(0, 2, 3, 1) )
							_UpperCamelCase					:		Optional[int] 				=   self.conv_in(lowerCamelCase__ )

							_UpperCamelCase					:		Optional[int] 				=   jnp.transpose(lowerCamelCase__ ,(0, 2, 3, 1) )
							_UpperCamelCase					:		Tuple 				=   self.controlnet_cond_embedding(lowerCamelCase__ )
							sample += controlnet_cond

							# 3. down
							_UpperCamelCase					:		Any 				=   (sample,)
							for down_block in self.down_blocks:
													if isinstance(lowerCamelCase__ ,lowerCamelCase__ ):
																			_UpperCamelCase				,			_UpperCamelCase					:		Union[str, Any] 				=   down_block(lowerCamelCase__ ,lowerCamelCase__ ,lowerCamelCase__ ,deterministic=not train )
													else:
																			_UpperCamelCase				,			_UpperCamelCase					:		str 				=   down_block(lowerCamelCase__ ,lowerCamelCase__ ,deterministic=not train )
													down_block_res_samples += res_samples

							# 4. mid
							_UpperCamelCase					:		Optional[int] 				=   self.mid_block(lowerCamelCase__ ,lowerCamelCase__ ,lowerCamelCase__ ,deterministic=not train )

							# 5. contronet blocks
							_UpperCamelCase					:		Union[str, Any] 				=   ()
							for down_block_res_sample, controlnet_block in zip(lowerCamelCase__ ,self.controlnet_down_blocks ):
													_UpperCamelCase					:		List[str] 				=   controlnet_block(lowerCamelCase__ )
													controlnet_down_block_res_samples += (down_block_res_sample,)

							_UpperCamelCase					:		Optional[int] 				=   controlnet_down_block_res_samples

							_UpperCamelCase					:		Tuple 				=   self.controlnet_mid_block(lowerCamelCase__ )

							# 6. scaling
							_UpperCamelCase					:		Dict 				=   [sample * conditioning_scale for sample in down_block_res_samples]
							mid_block_res_sample *= conditioning_scale

							if not return_dict:
													return (down_block_res_samples, mid_block_res_sample)

							return FlaxControlNetOutput(
							    down_block_res_samples=lowerCamelCase__ ,mid_block_res_sample=lowerCamelCase__ )









from math import sqrt



def 		A_				(     _lowerCAmelCase     )						-> bool:
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ) and (
     number >= 0
 ), "'number' must been an int and positive"

 UpperCamelCase	:					List[Any]       	=   True

 # 0 and 1 are none primes.
 if number <= 1:
  UpperCamelCase	:					List[Any]       	=   False

 for divisor in range(2							,   int(round(sqrt(_lowerCAmelCase     )     )     ) + 1     ):
  # if 'number' divisible by 'divisor' then sets 'status'
  # of false and break up the loop.
  if number % divisor == 0:
   UpperCamelCase	:					Union[str, Any]       	=   False
   break

    # precondition
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ), "'status' must been from type bool"

 return status



def 		A_				(     _lowerCAmelCase     )						-> Any:
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ) and (n > 2), "'N' must been an int and > 2"

 # beginList: contains all natural numbers from 2 up to N
 UpperCamelCase	:					int       	=   list(range(2							,   n + 1     )     )

 UpperCamelCase	:					Optional[int]       	=   []  # this list will be returns.

 # actual sieve of erathostenes
 for i in range(len(_lowerCAmelCase     )     ):
  for j in range(i + 1							,   len(_lowerCAmelCase     )     ):
   if (begin_list[i] != 0) and (begin_list[j] % begin_list[i] == 0):
    UpperCamelCase	:					Tuple       	=   0

    # filters actual prime numbers.
 UpperCamelCase	:					str       	=   [x for x in begin_list if x != 0]

 # precondition
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ), "'ans' must been from type list"

 return ans



def 		A_				(     _lowerCAmelCase     )						-> Optional[Any]:
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ) and (n > 2), "'N' must been an int and > 2"

 UpperCamelCase	:					str       	=   []

 # iterates over all numbers between 2 up to N+1
 # if a number is prime then appends to list 'ans'
 for number in range(2							,   n + 1     ):
  if is_prime(_lowerCAmelCase     ):
   ans.append(_lowerCAmelCase     )

    # precondition
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ), "'ans' must been from type list"

 return ans



def 		A_				(     _lowerCAmelCase     )						-> Any:
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ) and number >= 0, "'number' must been an int and >= 0"

 UpperCamelCase	:					Optional[Any]       	=   []  # this list will be returns of the function.

 # potential prime number factors.

 UpperCamelCase	:					Tuple       	=   2

 UpperCamelCase	:					str       	=   number

 if number == 0 or number == 1:
  ans.append(_lowerCAmelCase     )

 # if 'number' not prime then builds the prime factorization of 'number'
 elif not is_prime(_lowerCAmelCase     ):
  while quotient != 1:
   if is_prime(_lowerCAmelCase     ) and (quotient % factor == 0):
    ans.append(_lowerCAmelCase     )
    quotient /= factor
   else:
    factor += 1

 else:
  ans.append(_lowerCAmelCase     )

 # precondition
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ), "'ans' must been from type list"

 return ans



def 		A_				(     _lowerCAmelCase     )						-> Any:
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ) and (
     number >= 0
 ), "'number' bust been an int and >= 0"

 UpperCamelCase	:					List[Any]       	=   0

 # prime factorization of 'number'
 UpperCamelCase	:					Any       	=   prime_factorization(_lowerCAmelCase     )

 UpperCamelCase	:					List[Any]       	=   max(_lowerCAmelCase     )

 # precondition
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ), "'ans' must been from type int"

 return ans



def 		A_				(     _lowerCAmelCase     )						-> Union[str, Any]:
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ) and (
     number >= 0
 ), "'number' bust been an int and >= 0"

 UpperCamelCase	:					List[Any]       	=   0

 # prime factorization of 'number'
 UpperCamelCase	:					Dict       	=   prime_factorization(_lowerCAmelCase     )

 UpperCamelCase	:					List[Any]       	=   min(_lowerCAmelCase     )

 # precondition
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ), "'ans' must been from type int"

 return ans



def 		A_				(     _lowerCAmelCase     )						-> Optional[Any]:
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ), "'number' must been an int"
 assert isinstance(number % 2 == 0							,   _lowerCAmelCase     ), "compare bust been from type bool"

 return number % 2 == 0



def 		A_				(     _lowerCAmelCase     )						-> List[Any]:
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ), "'number' must been an int"
 assert isinstance(number % 2 != 0							,   _lowerCAmelCase     ), "compare bust been from type bool"

 return number % 2 != 0



def 		A_				(     _lowerCAmelCase     )						-> Any:
 assert (
     isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ) and (number > 2) and is_even(_lowerCAmelCase     )
 ), "'number' must been an int, even and > 2"

 UpperCamelCase	:					List[str]       	=   []  # this list will returned

 # creates a list of prime numbers between 2 up to 'number'
 UpperCamelCase	:					Dict       	=   get_prime_numbers(_lowerCAmelCase     )
 UpperCamelCase	:					Tuple       	=   len(_lowerCAmelCase     )

 # run variable for while-loops.
 UpperCamelCase	:					Optional[int]       	=   0
 UpperCamelCase	:					int       	=   None

 # exit variable. for break up the loops
 UpperCamelCase	:					Union[str, Any]       	=   True

 while i < len_pn and loop:
  UpperCamelCase	:					Tuple       	=   i + 1

  while j < len_pn and loop:
   if prime_numbers[i] + prime_numbers[j] == number:
    UpperCamelCase	:					Any       	=   False
    ans.append(prime_numbers[i]     )
    ans.append(prime_numbers[j]     )

   j += 1

  i += 1

 # precondition
 assert (
     isinstance(_lowerCAmelCase							,   _lowerCAmelCase     )
     and (len(_lowerCAmelCase     ) == 2)
     and (ans[0] + ans[1] == number)
     and is_prime(ans[0]     )
     and is_prime(ans[1]     )
 ), "'ans' must contains two primes. And sum of elements must been eq 'number'"

 return ans



def 		A_				(     _lowerCAmelCase							,   _lowerCAmelCase     )						-> str:
 assert (
     isinstance(_lowerCAmelCase							,   _lowerCAmelCase     )
     and isinstance(_lowerCAmelCase							,   _lowerCAmelCase     )
     and (numbera >= 0)
     and (numbera >= 0)
 ), "'number1' and 'number2' must been positive integer."

 UpperCamelCase	:					Tuple       	=   0

 while numbera != 0:
  UpperCamelCase	:					Tuple       	=   numbera % numbera
  UpperCamelCase	:					Any       	=   numbera
  UpperCamelCase	:					Union[str, Any]       	=   rest

 # precondition
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ) and (
     numbera >= 0
 ), "'number' must been from type int and positive"

 return numbera



def 		A_				(     _lowerCAmelCase							,   _lowerCAmelCase     )						-> int:
 assert (
     isinstance(_lowerCAmelCase							,   _lowerCAmelCase     )
     and isinstance(_lowerCAmelCase							,   _lowerCAmelCase     )
     and (numbera >= 1)
     and (numbera >= 1)
 ), "'number1' and 'number2' must been positive integer."

 UpperCamelCase	:					Optional[int]       	=   1  # actual answer that will be return.

 # for kgV (x,1)
 if numbera > 1 and numbera > 1:
  # builds the prime factorization of 'number1' and 'number2'
  UpperCamelCase	:					List[Any]       	=   prime_factorization(_lowerCAmelCase     )
  UpperCamelCase	:					Union[str, Any]       	=   prime_factorization(_lowerCAmelCase     )

 elif numbera == 1 or numbera == 1:
  UpperCamelCase	:					Optional[Any]       	=   []
  UpperCamelCase	:					int       	=   []
  UpperCamelCase	:					List[Any]       	=   max(_lowerCAmelCase							,   _lowerCAmelCase     )

 UpperCamelCase	:					Optional[int]       	=   0
 UpperCamelCase	:					Tuple       	=   0

 UpperCamelCase	:					List[str]       	=   []  # captured numbers int both 'primeFac1' and 'primeFac2'

 # iterates through primeFac1
 for n in prime_fac_a:
  if n not in done:
   if n in prime_fac_a:
    UpperCamelCase	:					str       	=   prime_fac_a.count(_lowerCAmelCase     )
    UpperCamelCase	:					Tuple       	=   prime_fac_a.count(_lowerCAmelCase     )

    for _ in range(max(_lowerCAmelCase							,   _lowerCAmelCase     )     ):
     ans *= n

   else:
    UpperCamelCase	:					str       	=   prime_fac_a.count(_lowerCAmelCase     )

    for _ in range(_lowerCAmelCase     ):
     ans *= n

   done.append(_lowerCAmelCase     )

    # iterates through primeFac2
 for n in prime_fac_a:
  if n not in done:
   UpperCamelCase	:					Any       	=   prime_fac_a.count(_lowerCAmelCase     )

   for _ in range(_lowerCAmelCase     ):
    ans *= n

   done.append(_lowerCAmelCase     )

    # precondition
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ) and (
     ans >= 0
 ), "'ans' must been from type int and positive"

 return ans



def 		A_				(     _lowerCAmelCase     )						-> Tuple:
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ) and (n >= 0), "'number' must been a positive int"

 UpperCamelCase	:					int       	=   0
 UpperCamelCase	:					int       	=   2  # this variable holds the answer

 while index < n:
  index += 1

  ans += 1  # counts to the next number

  # if ans not prime then
  # runs to the next prime number.
  while not is_prime(_lowerCAmelCase     ):
   ans += 1

    # precondition
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ) and is_prime(
     _lowerCAmelCase     ), "'ans' must been a prime number and from type int"

 return ans



def 		A_				(     _lowerCAmelCase							,   _lowerCAmelCase     )						-> int:
 assert (
     is_prime(_lowerCAmelCase     ) and is_prime(_lowerCAmelCase     ) and (p_number_a < p_number_a)
 ), "The arguments must been prime numbers and 'pNumber1' < 'pNumber2'"

 UpperCamelCase	:					str       	=   p_number_a + 1  # jump to the next number

 UpperCamelCase	:					Dict       	=   []  # this list will be returns.

 # if number is not prime then
 # fetch the next prime number.
 while not is_prime(_lowerCAmelCase     ):
  number += 1

 while number < p_number_a:
  ans.append(_lowerCAmelCase     )

  number += 1

  # fetch the next prime number.
  while not is_prime(_lowerCAmelCase     ):
   number += 1

    # precondition
 assert (
     isinstance(_lowerCAmelCase							,   _lowerCAmelCase     )
     and ans[0] != p_number_a
     and ans[len(_lowerCAmelCase     ) - 1] != p_number_a
 ), "'ans' must been a list without the arguments"

 # 'ans' contains not 'pNumber1' and 'pNumber2' !
 return ans



def 		A_				(     _lowerCAmelCase     )						-> List[str]:
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ) and (n >= 1), "'n' must been int and >= 1"

 UpperCamelCase	:					Dict       	=   []  # will be returned.

 for divisor in range(1							,   n + 1     ):
  if n % divisor == 0:
   ans.append(_lowerCAmelCase     )

    # precondition
 assert ans[0] == 1 and ans[len(_lowerCAmelCase     ) - 1] == n, "Error in function getDivisiors(...)"

 return ans



def 		A_				(     _lowerCAmelCase     )						-> int:
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ) and (
     number > 1
 ), "'number' must been an int and >= 1"

 UpperCamelCase	:					int       	=   get_divisors(_lowerCAmelCase     )

 # precondition
 assert (
     isinstance(_lowerCAmelCase							,   _lowerCAmelCase     )
     and (divisors[0] == 1)
     and (divisors[len(_lowerCAmelCase     ) - 1] == number)
 ), "Error in help-function getDivisiors(...)"

 # summed all divisors up to 'number' (exclusive), hence [:-1]
 return sum(divisors[:-1]     ) == number



def 		A_				(     _lowerCAmelCase							,   _lowerCAmelCase     )						-> Optional[Any]:
 assert (
     isinstance(_lowerCAmelCase							,   _lowerCAmelCase     )
     and isinstance(_lowerCAmelCase							,   _lowerCAmelCase     )
     and (denominator != 0)
 ), "The arguments must been from type int and 'denominator' != 0"

 # build the greatest common divisor of numerator and denominator.
 UpperCamelCase	:					List[str]       	=   gcd(abs(_lowerCAmelCase     )							,   abs(_lowerCAmelCase     )     )

 # precondition
 assert (
     isinstance(_lowerCAmelCase							,   _lowerCAmelCase     )
     and (numerator % gcd_of_fraction == 0)
     and (denominator % gcd_of_fraction == 0)
 ), "Error in function gcd(...,...)"

 return (numerator // gcd_of_fraction, denominator // gcd_of_fraction)



def 		A_				(     _lowerCAmelCase     )						-> Dict:
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ) and (n >= 0), "'n' must been a int and >= 0"

 UpperCamelCase	:					str       	=   1  # this will be return.

 for factor in range(1							,   n + 1     ):
  ans *= factor

 return ans



def 		A_				(     _lowerCAmelCase     )						-> Tuple:
 assert isinstance(_lowerCAmelCase							,   _lowerCAmelCase     ) and (n >= 0), "'n' must been an int and >= 0"

 UpperCamelCase	:					Dict       	=   0
 UpperCamelCase	:					Dict       	=   1
 UpperCamelCase	:					Union[str, Any]       	=   1  # this will be return

 for _ in range(n - 1     ):
  UpperCamelCase	:					Any       	=   ans
  ans += fiba
  UpperCamelCase	:					str       	=   tmp

 return ans
