Warning, I may have misunderstood the question and this solution may not present Carrys by the mathematical method.
The mathematical solution that you want and that I have developed (I do not know if someone has done this before, because I am an engineer and not a mathematician, if anyone has a reference, please inform in the comments, which I would like to analyze and quote here in this answer) is this:
Belowisanexamplewiththecellformulasshownnext(inthisexample,thecolumnis"I" and the initial data line is 13)
Howcalculationswork:
First you have to calculate the number of digits of the number to be analyzed, this is done through the entire part of the result of the base 10 logarithm of that number plus one.
The base log 10, for values such as 10, 100 and 1000, only returns integers, respectively 1, 2 and 3 in this example (their respective powers).
Thus, an integer value that is between 10 ^ 3 (1000) and 10 ^ 4 (10000), will have the result of its base log 10 between 3 and 4, never 3 (would be 1000) or 4 (would be 10000 ).
In this way, above 1000 (which has four digits, equal to its power plus one) and below 10000 (which has five digits, equal to its power plus one), all integer values in this range will necessarily have four digits , and the result of their logarithms will always be greater than 3 and less than 4.
So, by taking the whole part of this calculation and adding one, we get the number of digits of the integer parsed.
To be a Carry, all digits must be equal, so by getting the first digit of this number we can generate a Carry with it (of even numbers of digits of the original value) and compare if they are the same.
Taking the integer part of the result of dividing this value by 10 to its number of digits and multiplying by 10, we get an integer that is the first digit of the value analyzed.
To repeat this digit by the number of digits of the analyzed value, you must obtain the same number of 1s, so that, by multiplying by this first digit, the result returns its respective Carry.
Since 1/9 gives a decimal of 1s, just take the amount of 1s needed for multiplication.
This is done by calculating the integer part of the tithe times 10 to the number of digits.
When you multiply the first digit by 1s, you get Carry.
When subtracting the value of the Carry obtained by the value analyzed, if the result is zero, it is a Carry, otherwise it is not a Carry.
The number of digits should be considered when obtaining Carry.
Do this for every part of your equation!