OFFSET
0,1
LINKS
Paolo Xausa, Table of n, a(n) for n = 0..10000
EXAMPLE
a(3) = 1 because the sum of the first 3 primes is 2 + 3 + 5 = 10, the nearest prime is 11 and 11 - 10 = 1.
MATHEMATICA
pDist[n_]:=If[PrimeQ[n], 0, Min[NextPrime[n]-n, n-NextPrime[n, -1]]];
A366092list[nmax_]:=Map[pDist, Prepend[Accumulate[Prime[Range[nmax]]], 0]];
A366092list[100]
PROG
(Python)
from sympy import prime, nextprime, prevprime
def A366092(n): return min((m:=sum(prime(i) for i in range(1, n+1)))-prevprime(m+1), nextprime(m)-m) if n else 2 # Chai Wah Wu, Oct 03 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Paolo Xausa, Sep 29 2023
STATUS
approved