login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Number of decimal digits of the smallest solution for the reverse-and-subtract problem for cycle length n.
10

%I #38 Sep 28 2017 15:48:38

%S 0,4,0,18,32,0,42,44,48,24,42,12,40,8,50,368,16,100,410,118,0,12,442,

%T 584,546,1104,482,148,2786,536,398

%N Number of decimal digits of the smallest solution for the reverse-and-subtract problem for cycle length n.

%C Solution x for a given cycle length n for the reverse-and-subtract problem is defined as x = f^n(x), x <> f^j(x) for j < n, where f: k -> |k - reverse(k)|. For some cycle lengths (at least for 1, 3, 6 and 21) no solutions exist, these are marked as 0 in above sequence.

%C Zero cannot be considered a solution for cycle length 1 as there are nontrivial solutions for other numeral systems, such as 13 (one-three) in base 5 numeral system.

%C This is an excerpt which shows the smallest solutions with up to 50 digits only:

%C .n..#digits.....................................smallest.solution......ref

%C .2........4..................................................2178..A072141

%C .4.......18....................................169140971830859028..A292634

%C .5.......32......................10591266563195008940873343680499..A292635

%C .7.......42............142710354353443018141857289645646556981858..A292856

%C .8.......44..........16914079504181797053273763831171860502859028..A292857

%C .9.......48......111603518721165960373027269626940447783074704878..A292858

%C 10.......24..............................101451293600894707746789..A292859

%C 11.......42............166425621223026859056339052269787863565428..A292846

%C 12.......12..........................................118722683079..A072718

%C 13.......40..............1195005230033599502088049947699664004979..A292992

%C 14........8..............................................11436678..A072142

%C 15.......50....10695314508256806604321090888649339244708568530399..A292993

%C 17.......16......................................1186781188132188..A072719

%C 22.......12..........................................108811891188..A072143

%C Solutions for all cycle lengths up to 31 can be found below in the links section. Remember that a zero means there exists no solution for this specific cycle length.

%C There are two ways to find such solutions, first you can search in a given range of numbers e.g. from 10000000 to 99999999 and apply reverse-and-subtract to each number until you fall below the smallest number in this range (here: 10000000) or you find a cycle. Obviously, this works well only on small numbers up to 18-20 digits.

%C The second way is to construct a cycle with a given length n from the outside in until the innermost 2 digits of each number match the conditions for a valid cycle. This way it is possible to get the above results within seconds up to some hours depending on the specific cycle length even on an outdated PC.

%H J. H. E. Cohn, <a href="http://www.fq.math.ca/Scanned/28-2/cohn.pdf">Palindromic Differences</a>, Fibonacci Quart. (1990):113-120.

%H Thorsten Ehlers, <a href="/A215669/a215669.txt">smallest solutions for the reverse-and-subtract problem up to cycle length 31</a>

%e a(4) = 169140971830859028 as the smallest cycle with length 4 is 169140971830859028 -> 651817066348182933 -> 312535222687464777 -> 464929563535070436 ( -> 169140971830859028 ).

%Y Cf. A072141, A072142, A072143, A072718, A072719, A292634, A292635, A292846, A292856, A292857, A292858, A292859, A292992, A292993.

%K base,nonn,more

%O 1,2

%A _Thorsten Ehlers_, Aug 20 2012

%E Added a reference, formatted and added one more example in comments. - _Thorsten Ehlers_, Oct 06 2012

%E Sequences added to comments and crossrefs by _Ray Chandler_, Sep 27 2017