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-3 of 3 results.

A265109 a(n) = largest k such that prime(n) + A002110(k) is prime.

Original entry on oeis.org

0, 1, 2, 3, 3, 4, 6, 7, 8, 6, 5, 9, 8, 8, 14, 9, 16, 17, 14, 14, 16, 21, 11, 19, 14, 24, 25, 15, 18, 11, 28, 12, 8, 19, 16, 22, 35, 31, 36, 25, 31, 16, 40, 30, 23, 41, 39, 35, 10, 32, 43, 38, 24, 41, 19, 35, 23, 55, 54, 24, 53, 50, 57, 62, 48, 36, 64, 21, 45, 54
Offset: 1

Views

Author

Altug Alkan, Dec 01 2015

Keywords

Comments

a(n) = n-1 iff a(n) is in A035346 for n > 1.

Examples

			a(4) = 3 because A002110(3) + prime(4) = A002110(3) + 7 = 37 is prime.
		

Crossrefs

Programs

  • PARI
    a(n) = {my(k=1); while(k, if(ispseudoprime(prod(i=1, n-k, prime(i)) + prime(n)), return(n-k)); k++)}
    
  • Python
    from itertools import count
    from sympy import isprime, prime, primorial
    def A002110(n): return primorial(n) if n > 0 else 1
    def A265109(n):
        pn = prime(n)
        return next(k for k in range(n-1, -1, -1) if isprime(pn+A002110(k)))
    print([A265109(n) for n in range(1, 31)]) # Michael S. Branicky, Jan 10 2025

Formula

a(n) < n.

A356741 a(n) is the least prime(m) such that prime(n) + prime(m)# is prime, where prime(m)# denotes the product of the first m primes, or -1 if no such prime(m) exists.

Original entry on oeis.org

2, 2, 3, 2, 3, 2, 7, 3, 2, 3, 3, 2, 5, 3, 3, 2, 3, 3, 2, 3, 5, 3, 11, 3, 2, 3, 2, 5, 11, 5, 3, 2, 7, 2, 3, 3, 5, 3, 3, 2, 5, 2, 3, 2, 5, 5, 3, 2, 7, 3, 2, 5, 3, 3, 3, 2, 3, 3, 2, 5, 7, 3, 2, 7, 5, 3, 5, 2, 5, 3, 5, 3, 3, 5, 3, 5, 7, 5, 5, 2, 7, 2, 3, 11, 3, 5, 3
Offset: 2

Views

Author

Alain Rocchelli, Sep 04 2022

Keywords

Comments

Conjecture: Such a prime(m) exists for every n, i.e., a(n) is never -1 for n>1.
Conjecture: Limit_{N->oo} (Sum_{n=2..N} a(n)) / (Sum_{n=2..N} log(prime(n))) = C with C constant between 0.5 and 1 inclusive.

Examples

			For n=4, prime(4)=7, and m=1 gives prime(m)=2 and prime(n) + prime(m)# = 7 + 2 = 9 (nonprime), but m=2 gives prime(m)=3 and prime(n) + prime(m)# = 7 + 2*3 = 13 (prime), so a(4) = prime(2) = 3.
		

Crossrefs

Programs

  • PARI
    a(n) = my(p=2, pr=2, pn=prime(n)); while (!isprime(pn+pr), p=nextprime(p+1); pr *= p); p; \\ Michel Marcus, Sep 05 2022
  • Python
    from sympy import isprime, nextprime, prime
    def a(n):
        pn, pm, pmsharp = prime(n), 2, 2
        while not isprime(pn + pmsharp): pm = nextprime(pm); pmsharp *= pm
        return pm
    print([a(n) for n in range(2, 89)]) # Michael S. Branicky, Sep 04 2022
    

Formula

a(n) = prime(A100380(n)). - Michel Marcus, Sep 12 2022

A380026 a(n) is the smallest prime p such that p - a(n-1) is a primorial, starting with a(1)=2.

Original entry on oeis.org

2, 3, 5, 7, 13, 19, 229, 439, 2749, 5059, 7369, 9679, 39709, 42019, 6469735249, 5766152219975951659023630035336134306565384015606066326325804059, 5766152219975951659023630035336134306565384015606073747063938869, 5766152219975951659023630035336134306565384015606073747287031739
Offset: 1

Views

Author

Hayden Chesnut, Jan 09 2025

Keywords

Examples

			a(4) = 7
For primes greater than 7:
11 - 7 = 4 is not in A002110
13 - 7 = 6 is in A002110 so a(5) = 13
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    from sympy import isprime, primorial
    def A002110(n): return primorial(n) if n > 0 else 1
    def agen(an=2): # generator of terms
        while True:
            yield an
            an = next(s for k in count(0) if isprime(s:=an+A002110(k)))
    print(list(islice(agen(), 18))) # Michael S. Branicky, Jan 10 2025
    
  • Python
    from sympy import isprime
    import primesieve
    it = primesieve.Iterator()
    chain = [2]
    pchain = []
    n = 1
    while len(chain) < 18:
        while True:
            p = it.next_prime()
            if isprime(chain[-1]+n):
                chain.append(chain[-1]+n)
                print(len(chain))
                break
            n *= p
        p = it.skipto(0)
        n = 1
    print(chain) # Hayden Chesnut, Jan 10 2025

Formula

a(n) = a(n-1) + A002110(A100380(A000720(a(n-1)))), for n > 1. - Michael S. Branicky, Jan 10 2025
Showing 1-3 of 3 results.