




'''simple docstring'''





import math

import tensorflow as tf
from packaging import version


def 					UpperCamelCase_(     snake_case							:	Optional[Any]					):

							'''simple docstring'''






							snake_case_      =				tf.convert_to_tensor(_UpperCAmelCase					)
							snake_case_      =				0.5 * (1.0 + tf.math.erf(x / tf.cast(tf.sqrt(2.0					)							,    x.dtype					)					))

							return x * cdf


def 					UpperCamelCase_(     snake_case							:	List[Any]					):

							'''simple docstring'''






							snake_case_      =				tf.convert_to_tensor(_UpperCAmelCase					)
							snake_case_      =				tf.cast(math.pi							,    x.dtype					)
							snake_case_      =				tf.cast(0.044715							,    x.dtype					)
							snake_case_      =				0.5 * (1.0 + tf.tanh(tf.sqrt(2.0 / pi					) * (x + coeff * tf.pow(_UpperCAmelCase							,    3					))					))

							return x * cdf


def 					UpperCamelCase_(     snake_case							:	Optional[int]					):

							'''simple docstring'''






							snake_case_      =				tf.convert_to_tensor(_UpperCAmelCase					)

							return x * tf.tanh(tf.math.softplus(_UpperCAmelCase					)					)


def 					UpperCamelCase_(     snake_case							:	str					):

							'''simple docstring'''






							snake_case_      =				tf.convert_to_tensor(_UpperCAmelCase					)
							snake_case_      =				tf.cast(0.044715							,    x.dtype					)
							snake_case_      =				tf.cast(0.7978845608							,    x.dtype					)

							return 0.5 * x * (1.0 + tf.tanh(x * coeffa * (1.0 + coeffa * x * x)					))


def 					UpperCamelCase_(     snake_case							:	Dict					):

							'''simple docstring'''






							snake_case_      =				tf.convert_to_tensor(_UpperCAmelCase					)
							snake_case_      =				tf.cast(1.702							,    x.dtype					)
							return x * tf.math.sigmoid(coeff * x					)


def 					UpperCamelCase_(     snake_case							:	List[Any]					):

							'''simple docstring'''






							return tf.clip_by_value(_gelu(_UpperCAmelCase					)							,    -1_0							,    1_0					)


def 					UpperCamelCase_(     snake_case							:	List[str]							,    snake_case							:	str=-1					):

							'''simple docstring'''






							snake_case_      =				tf.split(_UpperCAmelCase							,    2							,    axis=_UpperCAmelCase					)
							return a * tf.math.sigmoid(_UpperCAmelCase					)


if version.parse(tf.version.VERSION) >= version.parse("2.4"):


		def 					UpperCamelCase_(     snake_case							:	int					):

									'''simple docstring'''






									return tf.keras.activations.gelu(_UpperCAmelCase							,    approximate=_UpperCAmelCase					)

		_SCREAMING_SNAKE_CASE							:       List[Any]				=			tf.keras.activations.gelu




		_SCREAMING_SNAKE_CASE							:       str				=			approximate_gelu_wrap
else:
		_SCREAMING_SNAKE_CASE							:       List[str]				=			_gelu
		_SCREAMING_SNAKE_CASE							:       List[str]				=			_gelu_new


_SCREAMING_SNAKE_CASE							:       str				=			{
    '''gelu''': gelu,
    '''gelu_10''': gelu_aa,
    '''gelu_fast''': gelu_fast,
    '''gelu_new''': gelu_new,
    '''glu''': glu,
    '''mish''': mish,
    '''quick_gelu''': quick_gelu,
    '''relu''': tf.keras.activations.relu,
    '''sigmoid''': tf.keras.activations.sigmoid,
    '''silu''': tf.keras.activations.swish,
    '''swish''': tf.keras.activations.swish,
    '''tanh''': tf.keras.activations.tanh,
}




def 					UpperCamelCase_(     snake_case							:	int					):

							'''simple docstring'''






							if activation_string in ACTaFN:
														return ACTaFN[activation_string]
							else:
														raise KeyError(f'function {activation_string} not found in ACT2FN mapping {list(ACTaFN.keys()					)}'					)










'''simple docstring'''





def 					UpperCamelCase_(     snake_case							:	int = 1_0_0_0_0_0_0					):

							'''simple docstring'''






							snake_case_      =				set(range(3							,    snake_case							,    2					)					)
							primes.add(2					)
							for p in range(3							,    snake_case							,    2					):
														if p not in primes:
																					continue
														primes.difference_update(set(range(p * p							,    snake_case							,    snake_case					)					)					)

							snake_case_      =				[float(snake_case					) for n in range(limit + 1					)]

							for p in primes:
														for n in range(snake_case							,    limit + 1							,    snake_case					):
																					phi[n] *= 1 - 1 / p

							return int(sum(phi[2:]					)					)


if __name__ == "__main__":
		print(F"{solution() = }")




