




from math import factorial




def 		SCREAMING_SNAKE_CASE__   (       lowercase		,lowercase		,lowercase	)    ->  Dict:







   if successes > trials:
      raise ValueError("""successes must be lower or equal to trials"""	)
   if trials < 0 or successes < 0:
      raise ValueError("""the function is defined for non-negative integers"""	)
   if not isinstance(_UpperCamelCase		,_UpperCamelCase	) or not isinstance(_UpperCamelCase		,_UpperCamelCase	):
      raise ValueError("""the function is defined for non-negative integers"""	)
   if not 0 < prob < 1:
      raise ValueError("""prob has to be in range of 1 - 0"""	)
   snake_case :							Optional[Any]           =			(prob**successes) * ((1 - prob) ** (trials - successes))
   # Calculate the binomial coefficient: n! / k!(n-k)!
   snake_case :							List[str]           =			float(factorial(_UpperCamelCase	)	)
   coefficient /= factorial(_UpperCamelCase	) * factorial(trials - successes	)
   return probability * coefficient


if __name__ == "__main__":
       from doctest import testmod

       testmod()
       print('Probability of 2 successes out of 4 trails')
       print('with probability of 0.75 is:', end=' ')
       print(binomial_distribution(2, 4, 0.75))









a			:			Any												=					[sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100000)]


def 		lowercase_	(  _UpperCamelCase	):


			'''simple docstring'''







			__lowercase			       = 0
			while number:
						# Increased Speed Slightly by checking every 5 digits together.
						sum_of_digits_squared += DIGITS_SQUARED[number % 10_00_00]
						number //= 10_00_00

			return sum_of_digits_squared


# There are 2 Chains made,
# One ends with 89 with the chain member 58 being the one which when declared first,
# there will be the least number of iterations for all the members to be checked.

# The other one ends with 1 and has only one element 1.

# So 58 and 1 are chosen to be declared at the starting.

# Changed dictionary to an array to quicken the solution
a			:			list[bool | None]												=					[None] * 10000000
a			:			int												=					True
a			:			Any												=					False


def 		lowercase_	(  _UpperCamelCase	):


			'''simple docstring'''







			if CHAINS[number - 1] is not None:
						return CHAINS[number - 1]  # type: ignore

			__lowercase			       = chain(next_number(_UpperCamelCase	)	)
			__lowercase			       = number_chain

			while number < 10_00_00_00:
						__lowercase			       = number_chain
						number *= 10

			return number_chain


def 		lowercase_	(  _UpperCamelCase = 10_00_00_00	):


			'''simple docstring'''







			for i in range(1							,      _UpperCamelCase	):
						if CHAINS[i] is None:
									chain(i + 1	)

			return CHAINS[:number].count(_UpperCamelCase	)


if __name__ == "__main__":
	import doctest

	doctest.testmod()
	print(f'''{solution() = }''')


