login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A366092 Distance from the sum of the first n primes to the nearest prime. 3
2, 0, 0, 1, 0, 1, 0, 1, 2, 1, 2, 3, 0, 1, 0, 3, 2, 1, 2, 1, 2, 3, 4, 3, 4, 1, 2, 5, 2, 1, 4, 1, 4, 1, 2, 3, 4, 5, 2, 3, 2, 5, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 10, 1, 0, 11, 2, 1, 0, 3, 2, 3, 2, 7, 2, 1, 2, 3, 4, 3, 2, 3, 4, 5, 2, 5, 4, 3, 10, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
COMMENTS
Positions of zeros are given by A013916.
Positions of records are given by A366093.
LINKS
FORMULA
a(n) = A051699(A007504(n)).
a(n) = abs(A007504(n) - A366094(n)).
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
Cf. also A351830, A354330.
Sequence in context: A345375 A101669 A243067 * A086965 A256572 A025463
KEYWORD
nonn,easy
AUTHOR
Paolo Xausa, Sep 29 2023
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 1 04:03 EDT 2024. Contains 375575 sequences. (Running on oeis4.)