n = 1234
A = 1 B = 234 or A = 12 B = 34 or A = 123 B = 4
I am trying to find the minimum absolute difference between these pairs.
In general the arithmetic way of cutting an integer is with integer division and modulo arithmetic:
def cut(n: int, places: int): d = 10 ** places return divmod(n, d) # equivalent to (n // d, n % d) A, B = cut(1234, 1)