%I #12 Mar 28 2018 22:02:23
%S 1,2,3,1,2,1,2,3,1,1,2,4,5,1,1,2,3,2,3,3,1,1,2,2,1,1,2,3,4,2,3,2,1,1,
%T 1,2,3,1,1,2,3,2,3,3,2,1,2,2,1,4,1,6,7,3,1,2,1,1,2,2,3,1,2,3,1,2,3,4,
%U 1,4,5,2,3,1,4,4,1,2,3,2,3,1,2,2,1,1,1,2,3,3,1,3,1,1,1,3,4,3,2,3
%N Let f(n) = abs(lpd(n)-gpf(n)), where lpd(n) is the largest proper divisor of n and gpf(n) is the greatest prime factor of n. Sequence gives number of iterations for f(n) to reach zero.
%H Michael De Vlieger, <a href="/A075660/b075660.txt">Table of n, a(n) for n = 1..10000</a>
%H Jason Earls, <a href="https://pdfs.semanticscholar.org/4559/ac50797ddeda688576630c4d92229440a0a3.pdf#page=259">Smarandache iterations of the first kind on functions involving divisors and prime factors</a>, in Smarandache Notions Journal (2004), Vol. 14.1, page 259.
%e a(12)=4 because 12 -> 3 -> 2 -> 1 -> 0.
%t Array[-1 + Length@ NestWhileList[Function[n, Abs[If[n == 1, 0, #[[-2]]] - SelectFirst[Reverse@ #, PrimeQ]] &@ Divisors[n]], #, # > 0 &] &, 100] (* _Michael De Vlieger_, Mar 28 2018 *)
%o (PARI) lpd(n)=n/factor(n)[1,1];
%o gpf(n)=my(f=factor(n)[,1]); f[#f];
%o f(n)=abs(lpd(n)-gpf(n));
%o a(n)=my(k=1); while(n=f(n), k++); k \\ _Charles R Greathouse IV_, May 30 2014
%K nonn
%O 1,2
%A _Jason Earls_, Sep 23 2002