Divide & Add remainder

 

> Hello Seqfans,

> 

> Start the sequence S with a(1)

> - divide a(1) by the 1st digit of S

> - add the remainder to a(1) to get a(2)

> - divide a(2) by the 2nd digit of S

> - add the remainder to a(2) to get a(3)

> - divide a(3) by the 3rd digit of S

> - add the remainder to a(3) to get a(4)

> - divide a(4) by the 4th digit of S

> - add the remainder etc.

> 

> Never divide by 0 -- divide by 10 instead.

> 

> Example with a(1) = 13:

> S = 13

> S = 13, 13

> S = 13, 13, 14

> S = 13, 13, 14, 14

> S = 13, 13, 14, 14, 16,

> S = 13, 13, 14, 14, 16, 16,

> S = 13, 13, 14, 14, 16, 16, 16

> S = 13, 13, 14, 14, 16, 16, 16, 16,

> S = 13, 13, 14, 14, 16, 16, 16, 16, 16,

> S = 13, 13, 14, 14, 16, 16, 16, 16, 16, 16,

> S = 13, 13, 14, 14, 16, 16, 16, 16, 16, 16, 20,

> S = 13, 13, 14, 14, 16, 16, 16, 16, 16, 16, 20, 20,

> S = 13, 13, 14, 14, 16, 16, 16, 16, 16, 16, 20, 20, 22,

> S = 13, 13, 14, 14, 16, 16, 16, 16, 16, 16, 20, 20, 22, 22,

> S = 13, 13, 14, 14, 16, 16, 16, 16, 16, 16, 20, 20, 22, 22, 26,

> S = 13, 13, 14, 14, 16, 16, 16, 16, 16, 16, 20, 20, 22, 22, 26, 26,

> S = 13, 13, 14, 14, 16, 16, 16, 16, 16, 16, 20, 20, 22, 22, 26, 26, 28,

> S = 13, 13, 14, 14, 16, 16, 16, 16, 16, 16, 20, 20, 22, 22, 26, 26, 28, 28,

> S = 13, 13, 14, 14, 16, 16, 16, 16, 16, 16, 20, 20, 22, 22, 26, 26, 28, 28, 32,

> S = 13, 13, 14, 14, 16, 16, 16, 16, 16, 16, 20, 20, 22, 22, 26, 26, 28, 28, 32, 32,

> S = 13, 13, 14, 14, 16, 16, 16, 16, 16, 16, 20, 20, 22, 22, 26, 26, 28, 28, 32, 32, 34, ...

> 

> Do all integers end on a fixed point?

> Best,

> É.

> 

> 

 

 

Jason was quick to answer:

 

Hello Eric,

 

I have been working on your recent interesting sequence suggestion. We know there is a fixed point at a(n) when a(n) is divisible by each of the yet to be processed digits (with 0 interpreted as 10). So with the following Magma code I get the results below. You can run the Magma code at http://magma.maths.usyd.edu.au/calc

 

Many of the fixed points are multiples of LCM{1..10}=5*7*8*9=2520.

 

angelini :=

   procedure(

     start

   :

        N := 10^9

   )

        a := start;

        A := [];

        D := [];

        Dms := {**};

        for

              n in [1..N]

        do

              Append(~A,a);

              a_digits :=

                   [

                        d eq 0 select 10 else d

                   :

                        d in

                             Reverse(IntegerToSequence(a))

                   ];

              D cat:= a_digits;

              Dms join:= SequenceToMultiset(a_digits);

              if

                   IsDivisibleBy(

                        a,

                        LCM(Dms)

                   )

              then

                   printf

                        "a(1) = %o => a(%o) = %o, pending: %o.\n",

                        start, #A, a, Set(Dms);

                   break;

              end if;

              d := D[n];

              a +:= a mod d;

              Exclude(~Dms,d);

        end for;

   end procedure;

for n in [1..100] do

   angelini(n);

end for;

 

 

 

a(1) =  1 => a(1) = 1,           pending: { 1 }.

a(1) =  2 => a(1) = 2,           pending: { 2 }.

a(1) =  3 => a(1) = 3,           pending: { 3 }.

a(1) =  4 => a(1) = 4,           pending: { 4 }.

a(1) =  5 => a(1) = 5,           pending: { 5 }.

a(1) =  6 => a(1) = 6,           pending: { 6 }.

a(1) =  7 => a(1) = 7,           pending: { 7 }.

a(1) =  8 => a(1) = 8,           pending: { 8 }.

a(1) =  9 => a(1) = 9,           pending: { 9 }.

a(1) = 10 => a(1) = 10, p        ending: { 1, 10 }.

a(1) = 11 => a(1) = 11,          pending: { 1 }.

a(1) = 12 => a(1) = 12,          pending: { 1, 2 }.

a(1) = 13 => a(26949) = 40320,   pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 14 => a(29) = 48,         pending: { 2, 3, 4, 6, 8 }.

a(1) = 15 => a(1) = 15,          pending: { 1, 5 }.

a(1) = 16 => a(12267) = 10080,   pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 17 => a(13981) = 20160,   pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 18 => a(5328) = 5040,     pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 19 => a(12267) = 10080,   pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 20 => a(1) = 20,          pending: { 2, 10 }.

a(1) = 21 => a(2) = 22,          pending: { 1, 2 }.

a(1) = 22 => a(1) = 22,          pending: { 2 }.

a(1) = 23 => a(2) = 24,          pending: { 2, 3, 4 }.

a(1) = 24 => a(1) = 24,          pending: { 2, 4 }.

a(1) = 25 => a(19) = 48,         pending: { 1, 2, 4, 8 }.

a(1) = 26 => a(6942) = 12600,    pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 27 => a(6942) = 12600,    pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 28 => a(14222) = 22680,   pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 29 => a(5) = 36,          pending: { 3, 6 }.

a(1) = 30 => a(1) = 30,          pending: { 3, 10 }.

a(1) = 31 => a(5878) = 7560,     pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 32 => a(11942) = 17640,   pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 33 => a(1) = 33,          pending: { 3 }.

a(1) = 34 => a(8871) = 12600,    pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 35 => a(3187) = 5040,     pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 36 => a(1) = 36,          pending: { 3, 6 }.

a(1) = 37 => a(6) = 48,          pending: { 1, 3, 4, 6, 8 }.

a(1) = 38 => a(2) = 40,          pending: { 4, 8, 10 }.

a(1) = 39 => a(5) = 48,          pending: { 2, 4, 8 }.

a(1) = 40 => a(1) = 40,          pending: { 4, 10 }.

a(1) = 41 => a(4) = 44,          pending: { 2, 4 }.

a(1) = 42 => a(2) = 44,          pending: { 2, 4 }.

a(1) = 43 => a(9) = 60,          pending: { 2, 5, 6, 10 }.

a(1) = 44 => a(1) = 44,          pending: { 4 }.

a(1) = 45 => a(9) = 60,          pending: { 2, 5, 6, 10 }.

a(1) = 46 => a(2) = 48,          pending: { 4, 6, 8 }.

a(1) = 47 => a(12415) = 17640,   pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 48 => a(1) = 48,          pending: { 4, 8 }.

a(1) = 49 => a(5) = 60,          pending: { 5, 6, 10 }.

a(1) = 50 => a(1) = 50,          pending: { 5, 10 }.

a(1) = 51 => a(12415) = 17640,   pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 52 => a(5361) = 5040,     pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 53 => a(23824) = 32760,   pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 54 => a(2092) = 2520,     pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 55 => a(1) = 55,          pending: { 5 }.

a(1) = 56 => a(2092) = 2520,     pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 57 => a(7492) = 10080,    pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 58 => a(3) = 66,          pending: { 1, 6 }.

a(1) = 59 => a(4) = 66,          pending: { 3, 6 }.

a(1) = 60 => a(1) = 60,          pending: { 6, 10 }.

a(1) = 61 => a(12159) = 20160,   pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 62 => a(5486) = 10080,    pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 63 => a(2) = 66,          pending: { 3, 6 }.

a(1) = 64 => a(23815) = 40320,   pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 65 => a(2) = 70,          pending: { 5, 7, 10 }.

a(1) = 66 => a(1) = 66,          pending: { 6 }.

a(1) = 67 => a(5486) = 7560,     pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 68 => a(8) = 88,          pending: { 2, 4, 8 }.

a(1) = 69 => a(9763) = 15120,    pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 70 => a(1) = 70,          pending: { 7, 10 }.

a(1) = 71 => a(9763) = 15120,    pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 72 => a(3543) = 5040,     pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 73 => a(3988) = 5040,     pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 74 => a(7634) = 7560,     pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 75 => a(2) = 80,          pending: { 5, 8, 10 }.

a(1) = 76 => a(4003) = 5040,     pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 77 => a(1) = 77,          pending: { 7 }.

a(1) = 78 => a(23204) = 32760,   pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 79 => a(8) = 88,          pending: { 2, 4, 8 }.

a(1) = 80 => a(1) = 80,          pending: { 8, 10 }.

a(1) = 81 => a(6) = 88,          pending: { 2, 4, 8 }.

a(1) = 82 => a(4) = 88,          pending: { 4, 8 }.

a(1) = 83 => a(19886) = 32760,   pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 84 => a(2) = 88,          pending: { 4, 8 }.

a(1) = 85 => a(2) = 90,          pending: { 5, 9, 10 }.

a(1) = 86 => a(11) = 120,        pending: { 1, 2, 6, 8, 10 }.

a(1) = 87 => a(15342) = 22680,   pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 88 => a(1) = 88,          pending: { 8 }.

a(1) = 89 => a(2) = 90,          pending: { 9, 10 }.

a(1) = 90 => a(1) = 90,          pending: { 9, 10 }.

a(1) = 91 => a(15) = 120,        pending: { 1, 2, 6, 8, 10 }.

a(1) = 92 => a(9212) = 12600,    pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 93 => a(27142) = 42840,   pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 94 => a(3425) = 5040,     pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 95 => a(2) = 100,         pending: { 1, 5, 10 }.

a(1) = 96 => a(15233) = 20160,   pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 97 => a(6364) = 15120,    pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 98 => a(2291) = 2520,     pending: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.

a(1) = 99 => a(1) = 99,          pending: { 9 }.

a(1) = 100 => a(1) = 100,        pending: { 1, 10 }.

 

The length of each a(n) “flight”, before reaching a fixed points, would then look like this (bold figures above, for n=1 to 100):

 

SFP = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 40320, 48, 15, 10080, 20160, 5040, 10080, 20, 22, 22, 24, 24, 48, 12600, 12600, 22680, 36, 30, 7560, 17640, 33, 12600, 5040, 36, 48, 40, 48, 40, 44, 44, 60, 44, 60, 48, 17640, 48, 60, 50, 17640, 5040, 32760, 2520, 55, 2520, 10080, 66, 66, 60, 20160, 10080, 66, 40320, 70, 66, 7560, 88, 15120, 70, 15120, 5040, 5040, 7560, 80, 5040, 77, 32760, 88, 80, 88, 88, 32760, 88, 90, 120, 22680, 88, 90, 90, 120, 12600, 42840, 5040, 100, 20160, 15120, 2520, 99, 100, ...

 

Many thanks, Jason!

Best,

É.