A241183 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.
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, 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, 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
Offset: 1
Examples
Examples (in condensed notation): 1+1=2 2+2=4 ... 9+9=18 10+1=11+1=12+2=14+1=15+5=20 11+1=12+1=13+3=16+6=22 12+1=13+3=16+1=17+7=24 13+1=14+4=18+8=26 14+4=18+8=26+2=28 15+5=20+2=22+2=24+4=28+2=30 15+1=16+6=22+2=24... 15+1=16+1=17+7=24... 16+6=22+2=24+2=26+6=32 17+1=18+8=26+6=32+2=34 18+8=26+2=28+8=36 19+1=20+2=22+2=24+2=26+6=32+2=34+4=38 20+2=22+2=24+2=26+6=32+3=35+5=40 ...
References
- Eric Angelini, Posting to Sequence Fans Mailing List, Apr 20 2014.
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..10000 (first 49 terms from Hiroaki Yamanouchi)
Crossrefs
Programs
-
Mathematica
A241183[n_] := Module[{c=1, nx=n}, While[ ! AnyTrue[nx = Union[Flatten[nx + IntegerDigits[nx]]], # == 2 n &], c++]; Return[c]]; Join[Table[A241183[i], {i, 49}], -1, Table[A241183[i], {i, 51, 100}]] (* Robert Price, Mar 18 2019 *) (* The following is a program to detect any n that cannot reach 2n *) f[n_] := Module[{n2 = 2 n, totest = {2 n}, i}, While[Length[totest] > 0, x = First[totest]; totest = Rest[totest]; For[i = 1, i <= 9, i++, If[MemberQ[IntegerDigits[x - i], i], If[! MemberQ[totest, x - i], AppendTo[totest, x - i]]] ]; If[MemberQ[totest, n], Return[False]]]; Return[True]]; Select[Range[100], f[#] &] (* Robert Price, Mar 20 2019 *)
Extensions
a(11) corrected (was 5 should be 4) by David Consiglio, Jr., May 12 2014
a(11) corrected in example by David Consiglio, Jr., May 20 2014
a(13) corrected (including the example) and a(23)-a(49) from Hiroaki Yamanouchi, Sep 05 2014
Escape clause added to definition at the suggestion of Robert Price. - N. J. A. Sloane, Mar 18 2019
a(50)-a(100) from Robert Price, Mar 18 2019
Comments