



def        A       (      _lowerCamelCase       ,				_lowerCamelCase						):





							'''simple docstring'''




							_lowerCAmelCase  :							str				     =					0
							_lowerCAmelCase  :							Optional[int]				     =					len(_lowerCamelCase						) - 1

							while left <= right:
														# avoid divided by 0 during interpolation
														if sorted_collection[left] == sorted_collection[right]:
																					if sorted_collection[left] == item:
																												return left
																					else:
																												return None

														_lowerCAmelCase  :							List[str]				     =					left + ((item - sorted_collection[left]) * (right - left)) // (
														    sorted_collection[right] - sorted_collection[left]
														)

														# out of range check
														if point < 0 or point >= len(_lowerCamelCase						):
																					return None

														_lowerCAmelCase  :							Tuple				     =					sorted_collection[point]
														if current_item == item:
																					return point
														else:
																					if point < left:
																												_lowerCAmelCase  :							Tuple				     =					left
																												_lowerCAmelCase  :							Tuple				     =					point
																					elif point > right:
																												_lowerCAmelCase  :							Optional[Any]				     =					right
																												_lowerCAmelCase  :							Optional[int]				     =					point
																					else:
																												if item < current_item:
																																			_lowerCAmelCase  :							Optional[Any]				     =					point - 1
																												else:
																																			_lowerCAmelCase  :							List[Any]				     =					point + 1
							return None






def        A       (      _lowerCamelCase       ,				_lowerCamelCase       ,				_lowerCamelCase       ,				_lowerCamelCase						):





							'''simple docstring'''




							if sorted_collection[left] == sorted_collection[right]:
														if sorted_collection[left] == item:
																					return left
														else:
																					return None

							_lowerCAmelCase  :							Optional[int]				     =					left + ((item - sorted_collection[left]) * (right - left)) // (
							    sorted_collection[right] - sorted_collection[left]
							)

							# out of range check
							if point < 0 or point >= len(_lowerCamelCase						):
														return None

							if sorted_collection[point] == item:
														return point
							elif point < left:
														return interpolation_search_by_recursion(_lowerCamelCase       ,				_lowerCamelCase       ,				_lowerCamelCase       ,				_lowerCamelCase						)
							elif point > right:
														return interpolation_search_by_recursion(_lowerCamelCase       ,				_lowerCamelCase       ,				_lowerCamelCase       ,				_lowerCamelCase						)
							else:
														if sorted_collection[point] > item:
																					return interpolation_search_by_recursion(
																					    _lowerCamelCase       ,				_lowerCamelCase       ,				_lowerCamelCase       ,				point - 1						)
														else:
																					return interpolation_search_by_recursion(
																					    _lowerCamelCase       ,				_lowerCamelCase       ,				point + 1       ,				_lowerCamelCase						)






def        A       (      _lowerCamelCase						):





							'''simple docstring'''




							if collection != sorted(_lowerCamelCase						):
														raise ValueError("Collection must be ascending sorted"						)
							return True


if __name__ == "__main__":
						import sys
						_snake_case	=						0
						if debug == 1:
												_snake_case	=						[10, 30, 40, 45, 50, 66, 77, 93]
												try:
																		__assert_sorted(collection)
												except ValueError:
																		sys.exit("Sequence must be ascending sorted to apply interpolation search")
												_snake_case	=						67

						_snake_case	=						interpolation_search(collection, target)
						if result is not None:
												print(f'''{target} found at positions: {result}''')
						else:
												print("Not found")





def        A       (      _lowerCamelCase						):





							'''simple docstring'''




							if length <= 0 or not isinstance(_lowerCamelCase       ,				_lowerCamelCase						):
														raise ValueError("Length must be a positive integer."						)
							return [n * (2 * n - 1) for n in range(_lowerCamelCase						)]


if __name__ == "__main__":
						print(hexagonal_numbers(length=5))
						print(hexagonal_numbers(length=10))
