|
|
A323835
|
|
Start with n and repeatedly double it and apply the "delete multiple digits" map m -> A320485(m); a(n) is the number of steps needed to reach either 0 or 1, or -1 if neither 0 nor 1 is ever reached.
|
|
3
|
|
|
0, 0, 27, 12, 26, 41, 11, 31, 25, 4, 40, 1, 10, 37, 30, 43, 24, 35, 3, 42, 39, 15, 1, 20, 9, 2, 36, 26, 29, 13, 42, 32, 23, 1, 34, 44, 2, 18, 41, 21, 38, 45, 14, 15, 1, 45, 19, 2, 8, 30, 1, 20, 35, 2, 25, 1, 28, 27, 12, 26, 41, 1, 31, 43, 22, 34, 5, 20, 33, 30
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
The first values of k for which a(k) = -1 are 91, 182, 364, 455, 728, 910, 1456, 1729, 1820, 1853, 1879. - Giovanni Resta, Feb 04 2019
a(n) <= 64 for all n.
Let f(n) = A320486(2*n) and k = 9876543210. If n > k/2, then f(n) <= k. Note that a(n) = a(f(n)) + 1 if a(f(n)) >= 0 and a(n) = -1 if a(f(n)) = -1.
If k/2 < n <= k, then f(n) <= n*198/1000 < k/2. Thus if n > k, f(f(n)) <= k/2.
This means that we only need to study trajectories for 0 <= n <= k. The longest trajectories in this range have 64 steps and are reached by the 9 numbers 1233546907, 1323546907, 1335246907, 1335467407, 1335469072, 1335469207, 1335471907, 1337046907, 2133546907. The first application of f(.) takes all these numbers to the number 26709381, which then follows 63 steps to 1. Since these 9 numbers all have a double digit 3, they are not in the range of f and thus not part of a longer trajectory. Thus for all n > k, a(f(n)) <= 63, and a(n) <= 64.
There are 74801508 numbers in the range 0 <= n <= k such that a(n) = -1.
(End)
All trajectories will reach one of four cycles: 0, 1, 91, or 910. - Chai Wah Wu, Feb 11 2019
|
|
LINKS
|
|
|
EXAMPLE
|
As we can see from A320487, 2 reaches 1 in 27 steps: 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 3, 6, 12, 24, 48, 96, 192, 384, 768, 1536, 3072, 61, 1, so a(2)=27.
|
|
PROG
|
(Python)
mset, m, c = set(), n, 0
while True:
if m == 0 or m == 1:
return c
m = int('0'+''.join(d if str(2*m).count(d) == 1 else '' for d in str(2*m)))
if m in mset:
return -1
mset.add(m)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|