OFFSET
0,1
FORMULA
a(n) = a(n-1) + A051697(n).
EXAMPLE
n=1, closest prime is 2, add 2; a(1) = 2 + 2 = 4;
n=2, closest prime is 2, add 2; a(2) = 4 + 2 = 6;
n=3, closest prime is 3, add 3; a(3) = 6 + 3 = 9;
n=4, closest prime is 3 (taking the smaller of the equal closest primes 3 and 5, as in A051697), add 3 - a(4) = 9 + 3 = 12.
MATHEMATICA
Accumulate@ Table[MinimalBy[Prime[If[n < 2, 1, PrimePi[n]] + {0, 1}], Abs[n - #] &][[1]], {n, 0, 53}] (* Michael De Vlieger, Mar 12 2021 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Zeljko Vranic, Mar 09 2021
STATUS
approved