OFFSET
1,2
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
FORMULA
For each prime, find the closest cube (preceding or succeeding); subtract, take absolute value.
EXAMPLE
For 179, 125 is the preceding cube, 216 is the succeeding. 179-125 = 54, 216-179 = 37, so the distance is 37.
MATHEMATICA
dnc[n_]:=Module[{c=Surd[n, 3]}, Min[Ceiling[c]^3-n, n-Floor[c]^3]]; dnc/@ Prime[Range[80]] (* Harvey P. Dale, Jan 11 2017 *)
PROG
(PARI) a(n) = {p = prime(n); sc = sqrtnint(p, 3); min(p - sc^3, (sc+1)^3 - p); } \\ Michel Marcus, Jun 05 2014
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
STATUS
approved