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

A103688 a(n) = n if A103689(n)*n +/- 1 are twin primes; a(n) = 0 otherwise.

Original entry on oeis.org

0, 0, 0, 4, 0, 6, 0, 0, 9, 0, 0, 12, 0, 0, 15, 0, 0, 18, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 47, 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 72, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Pierre CAMI, Feb 12 2005

Keywords

Examples

			For n=5 2*5-1=9 is not prime, 2*5+1=11 is prime so a(5)=0.
For n=6 1*6-1=5 is prime, 1*6+1=7 is prime, 5 and 7 are twin primes so a(6)=6.
		

Crossrefs

Cf. A103689.

Programs

  • Mathematica
    lktp[n_]:=Module[{k=1},While[NoneTrue[k*n+{1,-1},PrimeQ],k++];If[AllTrue[k*n+{1,-1},PrimeQ],n,0]]; Array[lktp,100] (* The program uses the functions NoneTrue and AllTrue from Mathematica version 10 *) (* Harvey P. Dale, Sep 09 2014 *)
  • PARI
    a(n)=k=1;while(!isprime(k*n+1)&&!isprime(k*n-1),k++);k
    for(n=1,100,if(isprime(a(n)*n+1)&&isprime(a(n)*n-1),print1(n,", "));print1(0,", ")) \\ Derek Orr, Sep 09 2014

Extensions

Corrected by Harvey P. Dale, Sep 09 2014
Definition simplified by Derek Orr, Sep 09 2014

A034693 Smallest k such that k*n+1 is prime.

Original entry on oeis.org

1, 1, 2, 1, 2, 1, 4, 2, 2, 1, 2, 1, 4, 2, 2, 1, 6, 1, 10, 2, 2, 1, 2, 3, 4, 2, 4, 1, 2, 1, 10, 3, 2, 3, 2, 1, 4, 5, 2, 1, 2, 1, 4, 2, 4, 1, 6, 2, 4, 2, 2, 1, 2, 2, 6, 2, 4, 1, 12, 1, 6, 5, 2, 3, 2, 1, 4, 2, 2, 1, 8, 1, 4, 2, 2, 3, 6, 1, 4, 3, 2, 1, 2, 4, 12, 2, 4, 1, 2, 2, 6, 3, 4, 3, 2, 1, 4, 2
Offset: 1

Views

Author

Keywords

Comments

Conjecture: for every n > 1 there exists a number k < n such that n*k + 1 is a prime. - Amarnath Murthy, Apr 17 2001
A stronger conjecture: for every n there exists a number k < 1 + n^(.75) such that n*k + 1 is a prime. I have verified this up to n = 10^6. Also, the expression 1 + n^(.74) does not work as an upper bound (counterexample: n = 19). - Joseph L. Pe, Jul 16 2002
Stronger version of the conjecture verified up to 10^9. - Mauro Fiorentini, Jul 23 2023
It is known that, for almost all n, a(n) <= n^2. From Heath-Brown's result (1992) obtained with help of the GRH, it follows that a(n) <= (phi(n)*log(n))^2. - Vladimir Shevelev, Apr 30 2012
Conjecture: a(n) = O(log(n)*log(log(n))). - Thomas Ordowski, Oct 17 2014
I conjecture the opposite: a(n) / (log n log log n) is unbounded. See A194945 for records in this sequence. - Charles R Greathouse IV, Mar 21 2016

Examples

			If n=7, the smallest prime in the sequence 8, 15, 22, 29, ... is 29, so a(7)=4.
		

References

  • Steven R. Finch, Mathematical Constants, Cambridge, 2003, section 2.12, pp. 127-130.
  • P. Ribenboim, (1989), The Book of Prime Number Records. Chapter 4, Section IV.B.: The Smallest Prime In Arithmetic Progressions, pp. 217-223.

Crossrefs

Cf. A010051, A034694, A053989, A071558, A085420, A103689, A194944 (records), A194945 (positions of records), A200996.

Programs

  • Haskell
    a034693 n = head [k | k <- [1..], a010051 (k * n + 1) == 1]
    -- Reinhard Zumkeller, Feb 14 2013
    
  • Maple
    A034693 := proc(n)
        for k from 1 do
            if isprime(k*n+1) then
                return k;
            end if;
        end do:
    end proc: # R. J. Mathar, Jul 26 2015
  • Mathematica
    a[n_]:=(k=0; While[!PrimeQ[++k*n + 1]]; k); Table[a[n], {n,100}] (* Jean-François Alcover, Jul 19 2011 *)
  • PARI
    a(n)=if(n<0,0,s=1; while(isprime(s*n+1)==0,s++); s)
    
  • Python
    from sympy import isprime
    def a(n):
        k = 1
        while not isprime(k*n+1): k += 1
        return k
    print([a(n) for n in range(1, 99)]) # Michael S. Branicky, May 05 2022

Formula

It seems that Sum_{k=1..n} a(k) is asymptotic to (zeta(2)-1)*n*log(n) where zeta(2)-1 = Pi^2/6-1 = 0.6449... . - Benoit Cloitre, Aug 11 2002
a(n) = (A034694(n)-1) / n. - Joerg Arndt, Oct 18 2020

A053989 Smallest k such that nk-1 is prime.

Original entry on oeis.org

3, 2, 1, 1, 4, 1, 2, 1, 2, 2, 4, 1, 8, 1, 2, 2, 4, 1, 2, 1, 2, 2, 6, 1, 6, 4, 2, 3, 6, 1, 2, 1, 4, 2, 4, 2, 2, 1, 6, 2, 4, 1, 6, 1, 2, 3, 6, 1, 2, 3, 2, 2, 4, 1, 2, 3, 2, 3, 6, 1, 8, 1, 4, 2, 6, 2, 6, 1, 2, 2, 4, 1, 14, 1, 2, 2, 4, 3, 2, 1, 8, 2, 4, 1, 6, 3, 2, 3, 16, 1, 2, 4, 6, 3, 4, 2, 2, 1, 2, 2
Offset: 1

Views

Author

Henry Bottomley, Apr 04 2000

Keywords

Examples

			a(5)=4 because the smallest prime in the sequence 5k-1 (4,9,14,19,24...) is 19 when k=4
		

Crossrefs

Programs

Formula

a(n) = (A038700(n)+1)/n.

A200996 Least upper limit for numbers u and v such that u*n-1 and v*n+1 are both prime, u and v not necessarily distinct.

Original entry on oeis.org

3, 2, 2, 1, 4, 1, 4, 2, 2, 2, 4, 1, 8, 2, 2, 2, 6, 1, 10, 2, 2, 2, 6, 3, 6, 4, 4, 3, 6, 1, 10, 3, 4, 3, 4, 2, 4, 5, 6, 2, 4, 1, 6, 2, 4, 3, 6, 2, 4, 3, 2, 2, 4, 2, 6, 3, 4, 3, 12, 1, 8, 5, 4, 3, 6, 2, 6, 2, 2, 2, 8, 1, 14, 2, 2, 3, 6, 3, 4, 3, 8, 2, 4, 4, 12
Offset: 1

Views

Author

Reinhard Zumkeller, Feb 14 2013

Keywords

Comments

A103689(n) <= a(n) <= A071558(n).

Programs

  • Haskell
    a200996 n = max (a053989 n) (a034693 n)

Formula

a(n) = max {A053989(n), A034693(n)}.

A348347 Smallest k such that in the pairs of numbers j*k +- 1, none is prime for 1 <= j < n but at least one is prime for j = n; or 0 if no such k exists.

Original entry on oeis.org

1, 5, 92, 13, 208, 47, 512, 149, 1688, 145, 6686, 539, 4106, 757, 9970, 1217, 16012, 881, 56194, 2441, 53576, 3343, 111992, 2917, 152734, 2053, 49376, 6791, 839522, 4985, 114118, 30097, 567302, 17209, 493618, 33613, 991976, 28097, 758932, 91099, 1898368, 36271
Offset: 1

Views

Author

Pontus von Brömssen, Oct 13 2021

Keywords

Comments

Smallest k such that A103689(k) = n.
a(85) > 10^9 (unless a(85) = 0).

Examples

			a(3) = 92 because none of 92 +- 1 and 2*92 +- 1 are prime but 3*92 + 1 is prime; and for k < 92, either 3*k +- 1 are also both not prime, or some j*k +- 1 is prime for j < 3.
		

Crossrefs

Cf. A103689.

Programs

  • PARI
    f(n) = my(k=1); while (!isprime(k*n+1) && !isprime(k*n-1), k++); k; \\ A103689
    a(n) = my(k=1); while (f(k) != n, k++); k; \\ Michel Marcus, Oct 18 2021
  • Python
    from sympy import isprime
    def A348347(n):
        k = 1
        while 1:
            m = 1
            while m <= n and not (isprime(m*k-1) or isprime(m*k+1)): m += 1
            if m == n: return k
            k += 1
    
Showing 1-5 of 5 results.