



'''simple docstring'''





import math
def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase      ):



				"""simple docstring"""





				lowerCAmelCase__			:  List[str]											= 0
				lowerCAmelCase__			:  Any											= 0
				while num > 0:
								lowerCAmelCase__			:  str											= num % 8
								lowerCAmelCase__			:  Dict											= octal + (remainder * math.floor(math.pow(10							,   UpperCamelCase      )      ))
								counter += 1
								lowerCAmelCase__			:  Any											= math.floor(num / 8      )  # basically /= 8 without remainder if any
								# This formatting removes trailing '.0' from `octal`.
				return f"""0o{int(UpperCamelCase      )}"""
def        _SCREAMING_SNAKE_CASE  (	):



				"""simple docstring"""





				print("""\n2 in octal is:"""      )
				print(decimal_to_octal(2      )      )  # = 2
				print("""\n8 in octal is:"""      )
				print(decimal_to_octal(8      )      )  # = 10
				print("""\n65 in octal is:"""      )
				print(decimal_to_octal(65      )      )  # = 101
				print("""\n216 in octal is:"""      )
				print(decimal_to_octal(216      )      )  # = 330
				print("""\n512 in octal is:"""      )
				print(decimal_to_octal(512      )      )  # = 1000
				print("""\n"""      )


if __name__ == "__main__":
	main()







'''simple docstring'''





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.
_lowerCAmelCase										=     10
def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase							,   UpperCamelCase							,   UpperCamelCase							,   UpperCamelCase      ):



    """simple docstring"""





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



    """simple docstring"""





    lowerCAmelCase__			:  Optional[Any]											= 0
    lowerCAmelCase__			:  Optional[int]											= len(UpperCamelCase      )
    while left <= right:
        if right - left < precision:
            return lin_search(UpperCamelCase							,   UpperCamelCase							,   UpperCamelCase							,   UpperCamelCase      )

        lowerCAmelCase__			:  Tuple											= (left + right) // 3 + 1
        lowerCAmelCase__			:  List[str]											= 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]:
            lowerCAmelCase__			:  int											= one_third - 1
        elif array[two_third] < target:
            lowerCAmelCase__			:  Union[str, Any]											= two_third + 1

        else:
            lowerCAmelCase__			:  List[Any]											= one_third + 1
            lowerCAmelCase__			:  List[str]											= two_third - 1
    else:
        return -1
def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase							,   UpperCamelCase							,   UpperCamelCase							,   UpperCamelCase      ):



    """simple docstring"""





    if left < right:
        if right - left < precision:
            return lin_search(UpperCamelCase							,   UpperCamelCase							,   UpperCamelCase							,   UpperCamelCase      )
        lowerCAmelCase__			:  Dict											= (left + right) // 3 + 1
        lowerCAmelCase__			:  Tuple											= 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(UpperCamelCase							,   one_third - 1							,   UpperCamelCase							,   UpperCamelCase      )
        elif array[two_third] < target:
            return rec_ternary_search(two_third + 1							,   UpperCamelCase							,   UpperCamelCase							,   UpperCamelCase      )
        else:
            return rec_ternary_search(one_third + 1							,   two_third - 1							,   UpperCamelCase							,   UpperCamelCase      )
    else:
        return -1


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 _lowerCAmelCase										=     input('''Enter numbers separated by comma:\n''').strip()
 _lowerCAmelCase										=     [int(item.strip()) for item in user_input.split(''',''')]
 assert collection == sorted(collection), F"List must be ordered.\n{collection}."
 _lowerCAmelCase										=     int(input('''Enter the number to be found in the list:\n''').strip())
 _lowerCAmelCase										=     ite_ternary_search(collection, target)
 _lowerCAmelCase										=     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''')


