OFFSET
1,12
COMMENTS
For large n: Sum_{k=1..n} a(k) ~ n*log(n)/2 - n/2 (conjectured).
LINKS
Yuriy Sibirmovsky, Table of n, a(n) for n = 1..1000
Yuriy Sibirmovsky, Plot of sum_{k=1..n} a(k) for n = 1..20000
EXAMPLE
For n=14: b_0 = 14, not prime or 1 or 0. c_0 = 7. b_1 = 7 - 2 = 5. 5 is prime.
In short: 14 -> {7,2} -> 5. Number of runs a(14) = 1.
MATHEMATICA
Nm=100;
a=Table[0, {n, 1, Nm}];
Do[b0=n;
j=0;
While[PrimeQ[b0]==False&&b0!=1&&b0!=0, c=Reverse[Divisors[b0]];
b1=c[[2]]-b0/c[[2]];
b0=b1; j++];
a[[n]]=j, {n, 1, Nm}];
a
PROG
(PARI) stop(n) = (n<=1) || isprime(n);
a(n) = {b = n; nb = 0; while (! stop(b), d = divisors(b); c = d[#d-1]; b = c - b/c; nb++; ); nb; } \\ Michel Marcus, Sep 19 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Yuriy Sibirmovsky, Sep 17 2016
STATUS
approved