[seqfan] Re: Colorless integers
Jack Brennen
jfb at brennen.net
Wed Feb 23 02:12:47 CET 2011
I wrote a little program to find invariants for loops... Basically, the
idea being that there should be invariants of the form:
N*10^a + b always ends up in the same loop as long as the sum of
digits of N is equal to some value C.
The first such invariant that the program found was C=16, a=2, b=2.
The first such integer example under this invariant is the number 7902:
7902->7920->7938->7911->7929->7902.
Note that since the additions and subtractions never carry or borrow
beyond the tens column, all that matters is the digit sum of the prefix
(in this case "79" has digit sum 16). So the following numbers all
enter similar loops:
7902, 8802, 9702, 16902, 17802, 18702, 19602, 25902, 26802, 27702,
28602, 29502, ...
Another example, with a large prefix digit sum, is C=100, a=3, b=332.
If N has digit sum 100, the following loop is possible:
N*10^3 + 332
N*10^3 + 440
N*10^3 + 548
N*10^3 + 431
N*10^3 + 539
N*10^3 + 422
N*10^3 + 530
N*10^3 + 638
N*10^3 + 521
N*10^3 + 629
N*10^3 + 512
N*10^3 + 620
N*10^3 + 728
N*10^3 + 611
N*10^3 + 719
N*10^3 + 602
N*10^3 + 710
N*10^3 + 818
N*10^3 + 701
N*10^3 + 809
N*10^3 + 692
N*10^3 + 575
N*10^3 + 458
N*10^3 + 341
N*10^3 + 449
N*10^3 + 332
The loop has 25 steps in a cycle, 13 steps are each +108, the other
12 steps are each -117.
Seems obvious that you could find arbitrarily long loops, although
you would obviously be dealing with long numbers. The loop shown
above doesn't apply to any integer smaller than 199999999999332.
More information about the SeqFan
mailing list