Clear["`*"]

session = StartExternalSession["Python"]

carry = ExternalFunction[session,"def carry(a, b, p):
    carry = 0
    count = 0

    while len(a) is not 0 or len(b) is not 0:
        x = 0
        y = 0
        if len(a) > 0:
            x = a[-1]
            del a[-1]
        if len(b) > 0:
            y = b[-1]
            del b[-1]
        sum = x + y + carry

        if sum >= p:
            carry = int(sum/p)
            count += 1
        else:
            carry = 0
    return count"]

cp[n_,k_,p_] := carry[IntegerDigits[n,p],IntegerDigits[k,p],p]

ArrayPlot[Table[Table[If[cp[i,j,2] == 0 ,{1},{0}],{i,0,127}],{j,0,127}],DataReversed->True]