Saturday, October 27

A long loop

Eric Angelini's digit-difference/add-subtract/iterate procedure, to which I drew attention two weeks ago, continues to delight. I knew there was a length-25 loop starting with 20971:

 0 20971
 1 50232
 2 102345
 3 223459
 4 212312
 5 101102
 6 211223
 7 110212
 8 98101
 9 80983
10 170138
11 841395
12 408752
13 889984 *maximum
14 879840
15 758392
16 522717
17 217055
18 49552
19 103584
20 235927
21 111172
22 110521
23 95211
24 52103
25 20971

Now I have discovered a significantly longer loop starting with 204099163.

Update (3 Nov 2012): There exists an intermediate length-85 loop starting with 17175432.

Saturday, October 13

13094

Start with 13094. This is p.
From left to right, determine the absolute differences between p's adjacent digits:

1-3 = 2
3-0 = 3
0-9 = 9
9-4 = 5
4-1 = 3     (the last digit of p minus the first one)

Collecting the resulting digits, we get q = 23953.

If q > p, compute p + q. If q < p, compute p - q. Either way, this is our new p.
Repeat:

0     13094 + 23953
1     37047 + 47434
2     84481 - 40477
3     44004 -  4040
4     39964 + 60321
5    100285 ...

The procedure was created by Eric Angelini, who presented it to MathFun on October 9. I chose 13094 to illustrate the method because this is a number for which I do not have an eventual outcome. Lesser starting numbers end up in small loops, although it may take a while (for example 199, 10853, 10886) to get there. In my graph of ten million iterations of 13094's evolution, the upward climb is relentless.