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.

A366093 Indices of records in A366092.

Original entry on oeis.org

0, 11, 22, 27, 58, 61, 110, 126, 161, 545, 566, 592, 747, 775, 2286, 5343, 5360, 5741, 18245, 78272, 93999, 140690, 146338, 227734, 251721, 274297, 372294, 447238, 586777, 808500, 7185887, 10479806, 37485090, 85742340, 91332097, 111764212, 117522098, 556747657, 589122990
Offset: 1

Views

Author

Paolo Xausa, Sep 29 2023

Keywords

Crossrefs

Cf. A366092.

Programs

  • Mathematica
    pDist[n_]:=If[PrimeQ[n],0,Min[NextPrime[n]-n,n-NextPrime[n,-1]]];
    A366093list[upto_]:=Module[{r=-1,a={},d=Map[pDist,Prepend[Accumulate[Prime[Range[upto]]],0]]},Do[If[d[[i]]>r,r=d[[i]];AppendTo[a,i-1]],{i,upto}];a];
    A366093list[10000]
  • Python
    from itertools import count, islice
    from sympy import prevprime, nextprime
    def A366093_gen(): # generator of terms
        c, s, p = 2, 0, 1
        yield 0
        for i in count(1):
            if (m:=min((s:=s+(p:=nextprime(p)))-prevprime(s+1),nextprime(s)-s))>c:
                yield i
                c = m
    A366093_list = list(islice(A366093_gen(),20)) # Chai Wah Wu, Oct 03 2023

Extensions

a(31)-a(39) from Michael S. Branicky, Oct 03 2023

A366094 Least prime nearest to the sum of the first n primes.

Original entry on oeis.org

2, 2, 5, 11, 17, 29, 41, 59, 79, 101, 127, 157, 197, 239, 281, 331, 379, 439, 499, 569, 641, 709, 787, 877, 967, 1061, 1163, 1259, 1373, 1481, 1597, 1721, 1847, 1987, 2129, 2273, 2423, 2579, 2749, 2917, 3089, 3271, 3449, 3637, 3833, 4027, 4229, 4441, 4663, 4889
Offset: 0

Views

Author

Paolo Xausa, Sep 29 2023

Keywords

Examples

			a(3) = 11 because the sum of the first 3 primes is 2 + 3 + 5 = 10 and the nearest prime is 11.
a(10) = 127 because the sum of the first 10 primes is 129, which is equidistant from the nearest primes (127 and 131), and 127 is the smaller one.
		

Crossrefs

Programs

  • Mathematica
    pNearest[n_]:=If[PrimeQ[n],n,With[{np=NextPrime[n],pp=NextPrime[n,-1]},If[np-nA366094list[nmax_]:=Prepend[Map[pNearest,Accumulate[Prime[Range[nmax]]]],2];
    A366094list[100]
  • Python
    from sympy import prime, nextprime, prevprime
    def A366094(n): return (p if ((m:=sum(prime(i) for i in range(1,n+1)))<<1)-(p:=prevprime(m+1))<=(k:=nextprime(m)) else k) if n else 2 # Chai Wah Wu, Oct 03 2023
Showing 1-2 of 2 results.