


from __future__ import annotations

# This is the precision for this function which can be altered.
# It is recommended for users to keep this number greater than or equal to 10.
A				:       Optional[Any]      =  10





def 						_lowerCAmelCase							(     _lowerCAmelCase   ,						_lowerCAmelCase   ,						_lowerCAmelCase   ,						_lowerCAmelCase			)    ->						int:


						'''simple docstring'''






						for i in range(_lowerCAmelCase   ,						_lowerCAmelCase			):
												if array[i] == target:
																		return i
						return -1





def 						_lowerCAmelCase							(     _lowerCAmelCase   ,						_lowerCAmelCase			)    ->						int:


						'''simple docstring'''






						__snake_case				=		0
						__snake_case				=		len(_lowerCAmelCase			)
						while left <= right:
												if right - left < precision:
																		return lin_search(_lowerCAmelCase   ,						_lowerCAmelCase   ,						_lowerCAmelCase   ,						_lowerCAmelCase			)

												__snake_case				=		(left + right) // 3 + 1
												__snake_case				=		2 * (left + right) // 3 + 1

												if array[one_third] == target:
																		return one_third
												elif array[two_third] == target:
																		return two_third

												elif target < array[one_third]:
																		__snake_case				=		one_third - 1
												elif array[two_third] < target:
																		__snake_case				=		two_third + 1

												else:
																		__snake_case				=		one_third + 1
																		__snake_case				=		two_third - 1
						else:
												return -1





def 						_lowerCAmelCase							(     _lowerCAmelCase   ,						_lowerCAmelCase   ,						_lowerCAmelCase   ,						_lowerCAmelCase			)    ->						int:


						'''simple docstring'''






						if left < right:
												if right - left < precision:
																		return lin_search(_lowerCAmelCase   ,						_lowerCAmelCase   ,						_lowerCAmelCase   ,						_lowerCAmelCase			)
												__snake_case				=		(left + right) // 3 + 1
												__snake_case				=		2 * (left + right) // 3 + 1

												if array[one_third] == target:
																		return one_third
												elif array[two_third] == target:
																		return two_third

												elif target < array[one_third]:
																		return rec_ternary_search(_lowerCAmelCase   ,						one_third - 1   ,						_lowerCAmelCase   ,						_lowerCAmelCase			)
												elif array[two_third] < target:
																		return rec_ternary_search(two_third + 1   ,						_lowerCAmelCase   ,						_lowerCAmelCase   ,						_lowerCAmelCase			)
												else:
																		return rec_ternary_search(one_third + 1   ,						two_third - 1   ,						_lowerCAmelCase   ,						_lowerCAmelCase			)
						else:
												return -1


if __name__ == "__main__":
	import doctest

	doctest.testmod()

	A				:       Union[str, Any]      =  input('Enter numbers separated by comma:\n').strip()
	A				:       Any      =  [int(item.strip()) for item in user_input.split(',')]
	assert collection == sorted(collection), f"List must be ordered.\n{collection}."
	A				:       Any      =  int(input('Enter the number to be found in the list:\n').strip())
	A				:       Optional[int]      =  ite_ternary_search(collection, target)
	A				:       int      =  rec_ternary_search(0, len(collection) - 1, collection, target)
	if resulta != -1:
		print(f'''Iterative search: {target} found at positions: {resulta}''')
		print(f'''Recursive search: {target} found at positions: {resulta}''')
	else:
		print('Not found')









from __future__ import annotations





def 						_lowerCAmelCase							(     _lowerCAmelCase			)    ->						list[int]:


						'''simple docstring'''






						__snake_case				=		2
						__snake_case				=		[]
						while i * i <= n:
												if n % i:
																		i += 1
												else:
																		n //= i
																		factors.append(_lowerCAmelCase			)
						if n > 1:
												factors.append(_lowerCAmelCase			)
						return factors


if __name__ == "__main__":
	import doctest

	doctest.testmod()





