OFFSET
1,2
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
Jason Earls, Smarandache iterations of the first kind on functions involving divisors and prime factors, in Smarandache Notions Journal (2004), Vol. 14.1, page 259.
EXAMPLE
a(12)=4 because 12 -> 3 -> 2 -> 1 -> 0.
MATHEMATICA
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 *)
PROG
(PARI) lpd(n)=n/factor(n)[1, 1];
gpf(n)=my(f=factor(n)[, 1]); f[#f];
f(n)=abs(lpd(n)-gpf(n));
a(n)=my(k=1); while(n=f(n), k++); k \\ Charles R Greathouse IV, May 30 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Jason Earls, Sep 23 2002
STATUS
approved