cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-2 of 2 results.

A366092 Distance from the sum of the first n primes to the nearest prime.

Original entry on oeis.org

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
Offset: 0

Views

Author

Paolo Xausa, Sep 29 2023

Keywords

Comments

Positions of zeros are given by A013916.
Positions of records are given by A366093.

Examples

			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.
		

Crossrefs

Programs

  • 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]
  • 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

Formula

a(n) = A051699(A007504(n)).
a(n) = abs(A007504(n) - A366094(n)).

A366205 Average of a twin prime pair which is the sum of the first k primes, for some k.

Original entry on oeis.org

6870, 25800, 38238, 125508, 128112, 220512, 372612, 3245688, 4286748, 15433968, 19659138, 23283852, 23494650, 23579262, 26233368, 32131272, 32380728, 34775988, 41299848, 58705260, 61470132, 63588432, 63873960, 91649652, 92774808, 106956252, 124336212, 159723300
Offset: 1

Views

Author

Paolo Xausa, Oct 04 2023

Keywords

Crossrefs

Intersection of A007504 with A014574.
Cf. A346706, A366094, A366206 (corresponding k values).

Programs

  • Mathematica
    With[{upto=10^4},Select[Accumulate[Prime[Range[upto]]],PrimeQ[#-1]&&PrimeQ[#+1]&]]

Formula

a(n) = A007504(A366206(n)).
Showing 1-2 of 2 results.