login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Start with n; add to it any of its digits; repeat; a(n) = minimal number of steps needed to reach 2n, or -1 if 2n cannot be reached.
11

%I #47 Mar 20 2019 19:09:37

%S 1,1,1,1,1,1,1,1,1,5,4,4,3,3,5,4,4,3,7,6,5,5,5,4,5,5,5,4,5,7,6,6,7,6,

%T 6,7,6,6,6,7,7,7,7,7,7,7,7,7,7,-1,8,8,8,7,8,8,8,8,8,10,9,9,9,10,11,10,

%U 10,10,11,12,11,12,12,11,12,12,14,12,13,15,12,13,14,14,14,14,14,15,14,14,16,16,16,15,15,17,16,15,15,18

%N Start with n; add to it any of its digits; repeat; a(n) = minimal number of steps needed to reach 2n, or -1 if 2n cannot be reached.

%C Is it a theorem that a(n) always exists?

%C Does any number take two steps to reach 2n by the shortest path? If the answer is yes, we should add the sequence of the smallest numbers that take n steps to go from k to 2k.

%C If the answer is no, then the sequence of the smallest numbers that take at least n steps to go from k to 2k.

%C There cannot be a 2 in this list. The maximum possible increase in two steps is 18 (2 nines) so no number larger than 18 can be doubled in 2 steps by digit addition. Since the minimum number of steps have been found through 18, and since none of them required exactly 2 steps, then there can be no 2s in this sequence. - _David Consiglio, Jr._, May 12 2014

%C a(50) does not exist. - _Hiroaki Yamanouchi_, Sep 05 2014

%C Except for n=50, 2n can be reached from all n<=10000. - _Robert Price_, Mar 20 2019

%D Eric Angelini, Posting to Sequence Fans Mailing List, Apr 20 2014.

%H Alois P. Heinz, <a href="/A241183/b241183.txt">Table of n, a(n) for n = 1..10000</a> (first 49 terms from Hiroaki Yamanouchi)

%e Examples (in condensed notation):

%e 1+1=2

%e 2+2=4

%e ...

%e 9+9=18

%e 10+1=11+1=12+2=14+1=15+5=20

%e 11+1=12+1=13+3=16+6=22

%e 12+1=13+3=16+1=17+7=24

%e 13+1=14+4=18+8=26

%e 14+4=18+8=26+2=28

%e 15+5=20+2=22+2=24+4=28+2=30

%e 15+1=16+6=22+2=24...

%e 15+1=16+1=17+7=24...

%e 16+6=22+2=24+2=26+6=32

%e 17+1=18+8=26+6=32+2=34

%e 18+8=26+2=28+8=36

%e 19+1=20+2=22+2=24+2=26+6=32+2=34+4=38

%e 20+2=22+2=24+2=26+6=32+3=35+5=40

%e ...

%t A241183[n_] := Module[{c=1, nx=n},

%t While[ ! AnyTrue[nx =

%t Union[Flatten[nx + IntegerDigits[nx]]], # == 2 n &], c++];

%t Return[c]];

%t Join[Table[A241183[i], {i, 49}], -1, Table[A241183[i], {i, 51, 100}]] (* _Robert Price_, Mar 18 2019 *)

%t (* The following is a program to detect any n that cannot reach 2n *)

%t f[n_] := Module[{n2 = 2 n, totest = {2 n}, i},

%t While[Length[totest] > 0,

%t x = First[totest]; totest = Rest[totest];

%t For[i = 1, i <= 9, i++,

%t If[MemberQ[IntegerDigits[x - i], i],

%t If[! MemberQ[totest, x - i], AppendTo[totest, x - i]]] ];

%t If[MemberQ[totest, n], Return[False]]]; Return[True]];

%t Select[Range[100], f[#] &] (* _Robert Price_, Mar 20 2019 *)

%Y Related sequences: A241173, A241174, A241175, A241176, A241177, A241178, A241179, A241180, A241181, A241182, A241183.

%K sign,base

%O 1,10

%A _N. J. A. Sloane_, Apr 23 2014

%E a(11) corrected (was 5 should be 4) by _David Consiglio, Jr._, May 12 2014

%E a(11) corrected in example by _David Consiglio, Jr._, May 20 2014

%E a(13) corrected (including the example) and a(23)-a(49) from _Hiroaki Yamanouchi_, Sep 05 2014

%E Escape clause added to definition at the suggestion of _Robert Price_. - _N. J. A. Sloane_, Mar 18 2019

%E a(50)-a(100) from _Robert Price_, Mar 18 2019