OFFSET
1,5
COMMENTS
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
Rémy Sigrist, Colored logarithmic pin plot of the first 1024 terms (where the color is function of the number m in the term d_m(n))
EXAMPLE
For n = 10:
- d_2(10) = |10 - 8| = 2,
- d_m(10) = |10 - 9| = 1 for m = 3..9,
- d_m(10) = 0 for any m >= 10,
- hence a(10) = 2 + 7*1 = 9.
PROG
(PARI) a(n) = my (v=0, d=oo); for (m=2, oo, my (k=logint(n, m)); d = min(d, min(n-m^k, m^(k+1)-n)); if (d, v+=d, return (v)))
CROSSREFS
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Aug 15 2018
STATUS
approved