OFFSET
1,7
COMMENTS
From Antti Karttunen, Apr 07 2020: (Start)
Also the least number of iterations of nondeterministic map k > k(k/p) needed to reach a power of 2, when any prime factor p of k can be used. The minimal length path to the nearest power of 2 (= 2^A064415(n)) is realized whenever one uses any of the A005087(k) distinct odd prime factors of the current k, at any step of the process. For example, this could be done by iterating with the map k > k(k/A078701(k)), i.e., by using the least odd prime factor of k (instead of the largest prime).
Proof: Viewing the prime factorization of changing k as a multiset ("bag") of primes, we see that liquefying any odd prime p with step p > (p1) brings at least one more 2 to the bag, while applying p > (p1) to any 2 just removes it from the bag, but gives nothing back. Thus the largest (and thus also the nearest) power of 2 is reached by eliminating  step by step  all odd primes from the bag, but none of 2's, and it doesn't matter in which order this is done.
The above implies also that the sequence is totally additive, which also follows because both A064097 and A064415 are. That A064097(n) = A329697(n) + A054725(n) for all n > 1 can be also seen by comparing the initial conditions and the recursion formulas of these three sequences.
For any n, A333787(n) is either the nearest power of 2 reached (= 2^A064415(n)), or occurs on some of the paths from n to there.
(End)
A003401 gives the numbers k where a(k) = A005087(k). See also A336477.  Antti Karttunen, Mar 16 2021
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..65537
Michael De Vlieger, Annotated fan style binary tree labeling the index n, with a color code where black represents a(n) = 0, red a(n) = 1, and magenta the largest value in a(n) for n = 1..16383.
FORMULA
From Antti Karttunen, Apr 0719 2020: (Start)
a(1) = a(2) = 0; and for n > 2, a(p) = 1 + a(p1) if p is an odd prime and a(n*m) = a(n) + a(m) if m,n > 1. [This is otherwise equal to the definition of A064097, except here we have a different initial condition, with a(2) = 0].
a(2n) = a(A000265(n)) = a(n).
a(p) = 1+a(p1), for all odd primes p.
If A209229(n) == 1 [when n is a power of 2], a(n) = 0,
Equivalently, for nonpowers of 2, a(n) = 1 + a(n(n/A078701(n))),
or equivalently, for nonpowers of 2, a(n) = 1 + Min a(n  n/p), for p prime and dividing n.
For all n >= 0, a(A334099(n)) = a(A000244(n)) = a(A000351(n)) = a(A001026(n)) = a(257^n) = a(65537^n) = n.
(End)
From Antti Karttunen, Mar 16 2021: (Start)
(End)
EXAMPLE
The trajectory of 15 is {12, 8}, taking 2 iterations to reach 8 = 2^3. So a(15) is 2.
From Antti Karttunen, Apr 07 2020: (Start)
Considering all possible paths from 15 to 1 nondeterministic map k > k(k/p), where p can be any prime factor of k, we obtain the following graph:
15
/ \
/ \
10 12
/ \ / \
/ \ / \
5 8 6
\__  __/
\__/ 
4 3
\ /
\ /
2

1.
It can be seen that there's also alternative route to 8 via 10 (with 10 = 15(15/3), where 3 is not the largest prime factor of 15), but it's not any shorter than the route via 12.
(End)
MATHEMATICA
a[n_] := Length@ NestWhileList[#  #/FactorInteger[#][[1, 1]] &, n, # != 2^IntegerExponent[#, 2] &] 1; Array[a, 100]
PROG
(PARI) A329697(n) = if(!bitand(n, n1), 0, 1+A329697(n(n/vecmax(factor(n)[, 1])))); \\ Antti Karttunen, Apr 07 2020
(PARI)
up_to = 2^24;
A329697list(up_to) = { my(v=vector(up_to)); v[1] = 0; for(n=2, up_to, v[n] = if(!bitand(n, n1), 0, 1+vecmin(apply(p > v[nn/p], factor(n)[, 1]~)))); (v); };
v329697 = A329697list(up_to);
A329697(n) = v329697[n]; \\ Antti Karttunen, Apr 07 2020
(PARI) A329697(n) = if(n<=2, 0, if(isprime(n), A329697(n1)+1, my(f=factor(n)); (apply(A329697, f[, 1])~ * f[, 2]))); \\ Antti Karttunen, Apr 19 2020
CROSSREFS
Cf. A000265, A003401, A005087, A052126, A053575, A054725, A064097, A064415, A078701, A087436, A147545, A171462, A209229, A333123, A333787, A333790, A334107, A334109, A335875, A334204, A335880, A335881, A336396, A336466, A336469 [= a(phi(n))], A336928 [= a(sigma(n))], A336470, A336477, A339970.
Cf. A000079, A334101, A334102, A334103, A334104, A334105, A334106 for positions of 0 .. 6 in this sequence, and also array A334100.
Cf. A334099 (a right inverse, positions of the first occurrence of each n).
KEYWORD
easy,nonn
AUTHOR
Ali Sada and Robert G. Wilson v, Feb 28 2020
STATUS
approved