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.

Previous Showing 11-20 of 52 results. Next

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.

A071558 Smallest k such that n*k + 1 and n*k - 1 are twin primes.

Original entry on oeis.org

4, 2, 2, 1, 6, 1, 6, 9, 2, 3, 18, 1, 24, 3, 2, 12, 6, 1, 12, 3, 2, 9, 6, 3, 6, 12, 4, 15, 12, 1, 42, 6, 6, 3, 12, 2, 54, 6, 8, 6, 30, 1, 24, 15, 4, 3, 6, 4, 18, 3, 2, 6, 120, 2, 12, 48, 4, 6, 18, 1, 258, 21, 14, 3, 30, 3, 24, 15, 2, 6, 18, 1, 84, 27, 2, 3, 6, 4, 132, 3, 10, 15, 54, 5, 12, 12
Offset: 1

Views

Author

Benoit Cloitre, May 30 2002

Keywords

Comments

Conjecture: a(n) < sqrt(n)*log(n) for all n > 17261. This has been verified for n up to 3*10^7. It implies the inequality a(n) < n for each n > 127. - Zhi-Wei Sun, Jan 07 2013
A200996(n) <= a(n). - Reinhard Zumkeller, Feb 14 2013

Crossrefs

Cf. A071407 (k at prime n).
Cf. A220143, A220144 (record values).

Programs

  • Haskell
    a071558 n = head [k | k <- [1..], let x = k * n,
                          a010051' (x - 1) == 1, a010051' (x + 1) == 1]
    -- Reinhard Zumkeller, Feb 14 2013
  • Mathematica
    Table[k=1; While[!And@@PrimeQ[n*k+{1,-1}],k++]; k,{n,86}] (* Jayanta Basu, May 26 2013 *)
  • PARI
    a(n) = my(s=1); while(isprime(s*n+1)*isprime(n*s-1)==0, s++); s;
    

A035096 a(n) is the smallest k such that prime(n)*k+1 is prime.

Original entry on oeis.org

1, 2, 2, 4, 2, 4, 6, 10, 2, 2, 10, 4, 2, 4, 6, 2, 12, 6, 4, 8, 4, 4, 2, 2, 4, 6, 6, 6, 10, 2, 4, 2, 6, 4, 8, 6, 10, 4, 14, 2, 2, 6, 2, 4, 18, 4, 10, 12, 24, 12, 2, 2, 6, 2, 6, 6, 8, 6, 4, 2, 6, 2, 4, 6, 6, 26, 6, 10, 6, 10, 14, 2, 6, 4, 12, 12, 24, 6, 8, 4, 2, 10, 2, 4, 10, 2, 8, 30
Offset: 1

Views

Author

Keywords

Comments

These arithmetic progressions have prime differences. Note that both the terms of generated by this k values and the differences are primes as well.
This is one possible generalization of "the least prime problem in special arithmetic progressions" when n in the nk+1 form is replaced by n-th prime number.
Note that Dirichlet's theorem on primes in arithmetic progressions implies that a(n) always exists. - Max Alekseyev, Jul 11 2008
If a(n)=2, prime(n) is a Sophie Germain prime (A005384). Among the first 10^6 terms, the largest is a(330408) = 234. - Zak Seidov, Jan 28 2012

Examples

			a(15)=6 because the 15th prime is 47, and the smallest k such that 47k+1 is prime is k=6, for which 47k+1=283.
		

Crossrefs

Smallest k such that k*n+1 is prime is A034693.
Sophie Germain primes are in A005384.
Cf. A000040, A035095. - Zak Seidov, Dec 27 2013
Cf. A117673.

Programs

  • Magma
    S:=[];
    k:=1;
    for n in [1..90] do
      while not IsPrime(k*NthPrime(n)+1) do
           k:=k+1;
      end while;
      Append(~S, k);
      k:=1;
    end for;
    S; // Bruno Berselli, Apr 18 2013
    
  • Mathematica
    Reap[Sow[1]; Do[p = Prime[n]; k = 2; While[! PrimeQ[k*p + 1], k = k + 2]; Sow[k], {n, 2, 10^4}]][[2, 1]] (* Zak Seidov, Jan 28 2012 *)
    f[n_] := Block[{p = Prime@ n}, q = 1 + 2p; While[ !PrimeQ@ q, q += 2p]; (q - 1)/p]; f[1] = 1; Array[f, 88] (* Robert G. Wilson v, Dec 27 2014 *)
  • PARI
    a(n) = if(n == 1, 1, my(t = 2*prime(n), m = t + 1); while(!isprime(m), m += t); 2*(m - 1)/t); \\ Amiram Eldar, Mar 19 2025

Formula

a(n) = (A035095(n)-1)/A000040(n). - Zak Seidov, Dec 27 2013

A035092 Smallest k such that (n^2)*k + 1 is prime.

Original entry on oeis.org

1, 1, 2, 1, 4, 1, 4, 3, 2, 1, 6, 3, 4, 1, 8, 1, 12, 4, 30, 1, 2, 3, 24, 1, 18, 1, 2, 4, 12, 2, 16, 12, 2, 3, 6, 1, 4, 13, 6, 1, 10, 2, 12, 6, 2, 6, 4, 8, 6, 9, 6, 9, 28, 1, 4, 1, 10, 3, 6, 4, 46, 4, 4, 3, 4, 1, 4, 3, 22, 6, 10, 2, 4, 1, 2, 7, 22, 3, 6, 4, 6, 3, 10, 1, 4, 3, 2, 4, 6, 1, 10, 4, 2, 1
Offset: 1

Views

Author

Keywords

Examples

			a(40) = 1 because in 1600k + 1 at k = 1, 1601 is the smallest prime;
a(61) = 46 because in the 46*46*k + 1 sequence the first prime appears at k = 46; it is 171167.
		

Crossrefs

Analogous case is A034693. See also A005574 and A002496.

Programs

  • Mathematica
    Table[k = 1; While[! PrimeQ[k (n^2) + 1], k++]; k, {n, 94}] (* Michael De Vlieger, Dec 17 2016 *)
  • PARI
    a(n)=k=1;while(!isprime(k*n^2+1),k++);k
    vector(100,n,a(n)) \\ Derek Orr, Oct 01 2014

A035093 Smallest k such that k*n! + 1 is prime.

Original entry on oeis.org

1, 1, 1, 3, 2, 3, 3, 4, 3, 3, 1, 2, 3, 13, 7, 4, 5, 2, 7, 17, 15, 18, 3, 6, 3, 16, 1, 4, 7, 20, 8, 3, 9, 5, 2, 7, 1, 3, 10, 3, 1, 29, 7, 9, 45, 8, 3, 6, 35, 66, 2, 20, 2, 4, 25, 52, 14, 34, 24, 6, 10, 22, 38, 16, 20, 91, 69, 12, 19, 20, 21, 42, 1, 5, 33, 77, 1, 2, 12, 29, 193, 74, 40, 55, 19
Offset: 1

Views

Author

Keywords

Comments

This is one possible generalization of "the least prime problem" for n*k+1 arithmetic progression when n is replaced by n!, a special difference.

Examples

			a(7)=3 because in progression of 5040*k+1 the terms 5041 and 10081 are not prime and so 15121 is the first prime.
		

Crossrefs

Analogous case is A034693. Special case for k=1 is A002981.

Programs

  • Mathematica
    Table[k = 1; While[! PrimeQ[1 + k*n!], k++]; k, {n, 85}] (* T. D. Noe, Nov 04 2013 *)
  • PARI
    a(n) = my(k=1); while(!isprime(k*n!+1), k++); k; \\ Michel Marcus, Sep 26 2020

Extensions

a(80) corrected by Alex Ratushnyak, Nov 03 2013
Simpler title by Sean A. Irvine, Sep 25 2020

A103689 a(n) is the least k such that either k*n - 1 or k*n + 1 (or both) is prime.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 2, 1, 2, 1, 4, 2, 2, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 4, 1, 2, 1, 6, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 1, 6, 1, 6, 1, 2, 2, 2, 1, 4, 1, 2, 1, 4, 1, 4, 1, 2, 2, 4, 1, 2, 1, 2, 1, 2, 1, 6, 2, 2, 1, 2, 1, 2, 3, 4, 3, 2, 1, 2, 1, 2, 1, 6, 1, 6, 1, 2
Offset: 1

Views

Author

Pierre CAMI, Feb 12 2005

Keywords

Crossrefs

Programs

  • Haskell
    a103689 n = min (a053989 n) (a034693 n)
    -- Reinhard Zumkeller, Feb 14 2013
    
  • Mathematica
    f[n_] := Block[{k = 1}, While[ ! PrimeQ[k*n - 1] && ! PrimeQ[k*n + 1], k++ ]; k]; Table[ f[n], {n, 105}] (* Robert G. Wilson v, Feb 12 2005 *)
    lk[n_]:=Module[{k=1},While[NoneTrue[k*n+{1,-1},PrimeQ],k++];k]; Array[ lk,120] (* The program uses the NoneTrue function from Mathematica version 10 *) (* Harvey P. Dale, May 01 2016 *)
  • PARI
    a(n) = my(k=1); while (!isprime(k*n+1) && !isprime(k*n-1), k++); k; \\ Michel Marcus, Oct 18 2021

Formula

a(n) <= A200996(n). - Reinhard Zumkeller, Feb 14 2013
a(n) = min {A053989(n), A034693(n)}. - Reinhard Zumkeller, Feb 14 2013
a(A002110(n)/3+3) >= ceiling((prime(n+1)-1)/3) for n >= 2. Equality holds for n = 2, 4, 6, 8, 10, 12, 22, 25, 31, 116, 155, 156, 197, ... . - Pontus von Brömssen, Oct 16 2021
a(A002110(n)/3-3) >= ceiling((prime(n+1)-1)/3) for n >= 3. Equality holds for n = 3, 4, 5, 6, 7, 9, 39, 51, 59, 65, 98, 311, ... . - Pontus von Brömssen, Oct 19 2021

Extensions

Edited, corrected and extended by Robert G. Wilson v, Feb 19 2005

A231819 Least positive k such that k*n^2 - 1 is a prime, or 0 if no such k exists.

Original entry on oeis.org

3, 1, 2, 2, 6, 2, 2, 2, 8, 2, 2, 3, 2, 3, 2, 5, 2, 2, 8, 5, 2, 2, 8, 2, 2, 3, 6, 2, 12, 3, 8, 5, 10, 2, 6, 2, 12, 2, 2, 3, 2, 2, 2, 3, 2, 2, 18, 3, 2, 2, 8, 2, 20, 3, 6, 2, 18, 3, 2, 3, 12, 2, 2, 2, 6, 7, 8, 6, 2, 3, 14, 3, 2, 3, 6, 2, 6, 3, 8, 2, 2, 5, 6, 5, 2
Offset: 1

Views

Author

Alex Ratushnyak, Nov 13 2013

Keywords

Crossrefs

Cf. A035092 (least k such that k*(n^2)+1 is a prime).
Cf. A175763 (least k such that k*(n^n)+1 is a prime).
Cf. A035093 (least k such that k*n!+1 is a prime).
Cf. A193807 (least k such that n*(k^2)+1 is a prime).
Cf. A231119 (least k such that n*(k^k)+1 is a prime).
Cf. A057217 (least k such that n*k!+1 is a prime).
Cf. A034693 (least k such that n*k +1 is a prime).
Cf. A231818 (least k such that k*(n^n)-1 is a prime).
Cf. A083663 (least k such that k*n!-1 is a prime).
Cf. A231734 (least k such that n*(k^2)-1 is a prime).
Cf. A231735 (least k such that n*(k^k)-1 is a prime).
Cf. A231820 (least k such that n*k!-1 is a prime).
Cf. A053989 (least k such that n*k -1 is a prime).

Programs

  • Mathematica
    Table[k = 1; While[! PrimeQ[k*n^2 - 1], k++]; k, {n, 100}] (* T. D. Noe, Nov 18 2013 *)

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)}.

A363533 Least k such that n*F(k)+1 is prime, where F = A000045 is the Fibonacci sequence, or -1 if no such k exists.

Original entry on oeis.org

1, 1, 3, 1, 3, 1, 9, 3, 3, 1, 3, 1, 9, 3, 3, 1, 6, 1, 9, 3, 3, 1, 3, 4, 18, 3, 9, 1, 3, 1, 15, 4, 3, 4, 3, 1, 9, 5, 3, 1, 3, 1, 48, 3, 9, 1, 24, 3, 9, 3, 3, 1, 3, 3, 9, 3, 6, 1, 24, 1, 36, 5, 3, 4, 3, 1, 12, 3, 3, 1, 6, 1, 12, 3, 3, 4, 6, 1, 9, 4, 3, 1, 3, 5
Offset: 1

Views

Author

Pontus von Brömssen, Jun 09 2023

Keywords

Comments

2 does not appear because F(1) = F(2).
a(n) is divisible by 3 if n >= 3 is odd (unless a(n) = -1), because F(k) is odd (so n*F(k)+1 > 2 is even) when k is not divisible by 3.

Examples

			For n = 17, the least k such that 17*F(k)+1 is prime is k = 6, with 17*F(6)+1 = 17*8+1 = 137, so a(17) = 6.
		

Crossrefs

Cf. A000045, A034693, A124067, A361902, A362376, A363534 (records), A363535 (indices of records), A363536 (first occurrences).

Programs

  • Mathematica
    Array[(k = 1; While[! PrimeQ[# Fibonacci[k] + 1], k++]; k) &, 85] (* Michael De Vlieger, Jun 10 2023 *)
  • PARI
    a(n) = my(k=1); while(!isprime(n*fibonacci(k)+1), k++); k; \\ Michel Marcus, Jun 10 2023
  • Python
    from sympy import isprime, fibonacci
    from itertools import count
    def A363533(n):
        # Note: the function hangs if a(n) = -1.
        return next(k for k in count(1) if isprime(n*fibonacci(k)+1))
    

Formula

a(n) = 1 if and only if n+1 is prime.

A034849 a(n) = 1 + 2*A034784(n).

Original entry on oeis.org

7, 11, 17, 19, 23, 29, 31, 41, 43, 47, 53, 59, 67, 71, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 163, 167, 173, 179, 181, 191, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 281, 283, 293, 307, 311, 317, 331
Offset: 1

Views

Author

Keywords

Comments

The terms are odd prime numbers.

Crossrefs

Programs

  • Mathematica
    1 + 2 Position[#, 2] &@ Table[k = 1; While[! PrimeQ[k n + 1], k++]; k, {n, 165}] // Flatten (* Michael De Vlieger, Jul 31 2017 *)
  • PARI
    lista(nn) = for (n=1, nn, if (isprime(p=2*n+1) && !isprime(n+1), print1(p, ", "));); \\ Michel Marcus, Aug 01 2017

Extensions

Edited by N. J. A. Sloane, Oct 27 2012
Previous Showing 11-20 of 52 results. Next