OFFSET
1,5
COMMENTS
Record values occur at prime values of n, and equal one less than the next lowest prime number (see Formula). Because of this, a(n) is always less than n, so for any positive integer starting value n, iterations of n -> n + gpf(n) will eventually join A076271.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
FORMULA
a(k*p) = prevprime(p) - k for all k <= prevprime(p).
a(p) = prevprime(p) - 1 for p > 2.
EXAMPLE
PROG
(PARI) gpf(n) = if (n==1, 1, my (f=factor(n)); f[#f~, 1])
a(n) = { my (o=1); for (k=0, oo, while (o<n, o=o+gpf(o)); if (o==n, return (k), n=n+gpf(n))) } \\ Rémy Sigrist, Apr 05 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Michael C. Case, Jan 08 2020
STATUS
approved