# [seqfan] Additions and subtractions with a visible result

Eric Angelini Eric.Angelini at kntv.be
Mon Oct 20 18:40:45 CEST 2014

```Hello SeqFans,

Look at this addition: 127 + 144 = 271
Did you notice that the result 271 was visible around the '+' sign?

Look at this subtraction: 744 - 301 = 443
Did you notice that the result 443 was visible around the '-' sign?

We have now almost all tools to play a kind of Collatz game.

The rules:

1) starting from integer A we will first try to find integer B < A
2) if this is not possible, we will accept B > A
3) if neither (1) nor (2) is possible, we end the procedure.

4) building B from A:

4a) say A is the concatenation of the digits: a1,a2,a3,...,an
4b) say B is the concatenation of the digits: b1,b2,b3,...,bm
4c) then R, the result of A-B must be precisely: a2,a3,...,an,b1
4d) if we can't find such a B, we try: R = A+B = a2,a3,...,an,b1
4e) if we can't find such a B, we try: R = A+B = a2,a3,...,an,b1,b2
4f) if we can't find such a B, we try: R = A+B = a2,a3,...,an,b1,b2,b3
4g) if we can't find (etc)

Example (4c), A-B = R:

A = 424 --> a1=4  a2=2  a3=4
- B = 183 --> b1=1
= R = 241 --> r1=a2=2  r2=a3=4  r3=b1=1

Example (4d); here, with A = 247, we won't be able to find any B:

A = 247 --> a1=2  a2=3  a3=7
- B = ...
= R = 47. --> r1=a2=4  r2=a3=7  r3= ?

We then try to find a B that fits A+B = R:

A = 247 --> a1=2  a2=3  a3=7
+ B = 225 --> b1=2
= R = 472 --> r1=a2=4  r2=a3=7  r3=b1=2

Another example of (4d):

A = 1167 --> a1=1  a2=1  a3=6  a4=7
+ B =  508 --> b1=5
= R = 1675 --> r1=a2=1  r2=a3=6  r3=a4=7  r4=b1=5

Example (4e), starting here with A = 67, we notice that the only
way to find a suitable B is to use b1 _and_ b2 to compute R:

A =  67 --> a1=6  a2=7
+ B = 703 --> b1=7  b2=0
= R = 770 --> r1=a2=7  r2=b1=7  r3=b2=0

Example (4f), starting here with A = 11, we notice that the only
way to find a suitable B is to use b1, b2, _and_ b3 to compute R:

A =   11 --> a1=1  a2=1
+ B = 1098 --> b1=1  b2=0  b3=9
= R = 1109 --> r1=a2=1  r2=b1=1  r3=b2=0  r4=b3=9

Of course, neither A nor B can start with a zero. But it is ok for R
(as R will not be a member of the sequence; R is only "the result").

Example:

A = 508 --> a1=5  a2=0  a3=8
- B = 424 --> b1=4
= R = 084 --> r1=a2=0  r2=a3=8  r4=b1=4

Let's now iterate 11, for instance.
We see that the sequence S(11) enters into a loop:

S(11) = 11, 1098, 117, 58, 24, 17, 58, L

The successive R's of S(11) are highlighted hereunder, together with
the sign of the operation involved (A+B or A-B):

R =       981-      82+     75+
S(11) = 11, 1098, 117, 58, 24, 17, 58, 24, ... L
R =  1109+     175+     41+     82+

Here are a few results I've computed by hand, for n=1 to 50
(E stands for END, L for LOOP):

S(1) = 1           E
S(2) = 2, 1,       E
S(3) = 3,          E
S(4) = 4, 2, 1     E
S(5) = 5,          E
S(6) = 6, 3,       E
S(7) = 7,          E
S(8) = 8, 4, 2, 1, E
S(9) = 9,          E
S(10) = 10, 5,     E
S(11) = 11, 1098, 117, 58, 24, 17, 58, L
S(12) = 12, 208, 127, 144, 298, 688, 193, 744, 301, 289, 607, 532, 210, 109, 18, 68, 13, 18,... L
S(13) = 13, 18, 68, 13,  L
S(14) = 14, 28, 57, 14,  L
S(15) = 15, 38, 46, 15,  L
S(16) = 16, 48, 35, 16,  L
S(17) = 17, 58, 24, 17,  L
S(18) = 18, 68, 13, 18,  L
S(19) = 19, 78, 802, 775, 23, 307, 235, 116, 48, 35, 16, ... L
S(20) = 20, 19, ... L
S(21) = 21, 1087, 215, 1297, 1674, 5071, 4357, 780, 22, 1, E
S(22) = 22, 1,  E
S(23) = 23, 307, ...    L
S(24) = 24, 17, 58, 24, L
S(25) = 25, 27, 47, 25, L
S(26) = 26, 37, 36, 26, L
S(27) = 27, 47, 25, 27, L
S(28) = 28, 57, 14, 28, L
S(29) = 29, 67, 703, 667, 6093, 5158, 3575, 2177, 403, 370, 333, 2999, 6997, 2975, 6781, 1030, 723, 489, 405, 352, 169, 526, 264, 379, 415, 263, 370, L
S(30) = 30, 28, ...  L
S(31) = 31, 1076, 313, 182, 644, 202, 181, 635, 283, 552, 4694, 2248, 234, 107, 34, 406, 343, 96, 33, 296, 670, 33, L
S(32) = 32, 11,  ... L
S(33) = 33, 296, ... L
S(34) = 34, 406, ... L
S(35) = 35, 16, 48, 35, L
S(36) = 36, 26, 37, 36, L
S(37) = 37, 36, 26, 37, L
S(38) = 38, 46, 15, 38, L
S(39) = 39, 56, 604, 559, 34, ... L
S(40) = 40, 37, ... L
S(41) = 41, 29, ... L
S(42) = 42, 20, ... L
S(43) = 43, 12, ... L
S(44) = 2, 1, E
S(45) = 45, 505, 451, 65, 14, ... L
S(46) = 46, 15, 38, 46, L
S(47) = 47, 25, 27, 57, L
S(48) = 48, 35, 16, 48, L
S(49) = 49, 45, ... L
S(50) = 50, 46, ... L
S(51) = 51, 38, ... L
S(52) = 52, 164, 480, 323, 85, 32, ... L
S(53) = 53, 21, ... E
S(54) = 54, 13, ... L
S(55) = 55, 549, 450, 55, L
S(56) = 56, 604, 559, 34, ... L
S(57) = 14, ... L
S(58) = 58, 24, 17, 58, L
S(59) = 59, 34, ... L
S(60) = 60, 55, ... L
S(61) = 61, 47, ... L
S(62) = 62, 39, ... L
S(63) = 63, 30, ... L
S(64) = 64, 22, 1, E
S(65) = 65, 14, ... L
S(66) = 66, 3, E
...

Will some integer A escape the END or LOOP fate?
Best,
É.

```