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 23 results. Next

A053714 Smallest (in magnitude) nonzero number m such that n!+m is prime.

Original entry on oeis.org

1, 1, 1, -1, 7, -1, -1, 23, -13, 11, 1, -1, -23, -1, 43, 23, 31, 37, 89, 29, 31, 31, -89, -73, 41, -37, 1, 67, -31, -1, -61, -1, -1, 97, 61, -127, 1, -1, -73, 53, 1, -79, 71, 47, -53, -89, -79, 53, -59, 61, -179, 53, -59, -127, -61, 149, 107, -109, -137, -139, -71, -71, -101, 67, -127, 283, 73, 83, -103, -97, -751, 101
Offset: 1

Views

Author

Labos Elemer, Feb 10 2000

Keywords

Comments

a(n) is the defined, nonzero (thus excluding a(1) and a(2) of A033933) minimum of A033932(n) and A033933(n) multiplied by -1 if that minimum is not A033932(n). If n!+m and n!-m are equidistant primes (A053709), we have (arbitrarily) chosen positive m.

Examples

			For n=4, the possible m are -1 (24-1) and +5 (24+5). The former is closer to 4! so a(4) is -1.
For n=5, the possible m are -7 (120-7) and +7 (120+7). Being equidistant to 5!, a(5) is +7.
		

Crossrefs

Cf. A006990, A037151, A033932, A033933, A053709, A056752 (unsigned version with a different second term).

Extensions

Edited by Hans Havermann, Jul 23 2014

A087421 Smallest prime >= n!.

Original entry on oeis.org

2, 2, 2, 7, 29, 127, 727, 5051, 40343, 362897, 3628811, 39916801, 479001629, 6227020867, 87178291219, 1307674368043, 20922789888023, 355687428096031, 6402373705728037, 121645100408832089, 2432902008176640029, 51090942171709440031, 1124000727777607680031
Offset: 0

Views

Author

Mitch Cervinka (puritan(AT)planetkc.com), Oct 22 2003

Keywords

Comments

n! is prime only when n=2. When n>2, for n!+m to be prime, m must be relatively prime to all the numbers from 2 to n. In particular, if m is between 2 and n, then (n!+m) will be divisible by m. Thus a(n) must be either n!+1, or else larger than n!+n.

Examples

			a(0) = 2 since 0! = 1 and 2 is the smallest prime >= 1.
a(4) = 29 since 4! = 24 and 29 is the smallest prime >= 24.
		

Crossrefs

Programs

  • Mathematica
    NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; Table[ NextPrim[n! - 1], {n, 0, 20}] (* Robert G. Wilson v, Oct 25 2003 *)
    Join[{2,2,2},NextPrime[Range[3,25]!]]  (* Harvey P. Dale, Feb 23 2011 *)
  • PARI
    a(n)=nextprime(n!); \\ R. J. Cano, Apr 08 2018
    
  • Python
    from sympy import factorial, nextprime
    def a(n): return nextprime(factorial(n)-1)
    print([a(n) for n in range(23)]) # Michael S. Branicky, May 22 2022

Formula

a(n) = min { p[i] | p[i]>=n! }, where p[i] is the set of prime numbers.
a(n) = A007918(A000142(n)). - Michel Marcus, Apr 09 2018

Extensions

Edited, corrected and extended by Robert G. Wilson v and Ray Chandler, Oct 25 2003

A245695 Least number k >= 0 such that (n!+k)/n is prime.

Original entry on oeis.org

1, 2, 0, 4, 25, 42, 49, 88, 207, 170, 121, 12, 377, 938, 285, 688, 391, 558, 703, 1780, 609, 682, 713, 2328, 3275, 1066, 1593, 28, 1943, 6690, 3317, 4064, 2607, 1258, 3395, 2196, 4847, 38, 1677, 3880, 2173, 42, 4171, 3124, 2115, 10994, 4747, 11184, 2597, 4150, 3111, 14092, 2809, 3834, 12265, 3976, 8493, 6206, 16697, 17580, 16531, 47678, 8253, 17344, 4355, 12738, 18961, 4964, 5727, 9170, 9869, 61704, 7373
Offset: 1

Views

Author

Derek Orr, Jul 29 2014

Keywords

Comments

a(n) = M*n for some integer M >= 0.
a(n) = n times least m >= 0 such that (n-1)!+m is prime. - Jens Kruse Andersen, Jul 30 2014

Examples

			(4!+0)/4 = 6 is not prime.
(4!+1)/4 = 25/4 is not prime.
(4!+2)/4 = 26/4 is not prime.
(4!+3)/4 = 27/4 is not prime.
(4!+4)/4 = 7 is prime. Thus a(4) = 4.
		

Crossrefs

Programs

  • PARI
    a(n)=for(k=0,10^6,s=(n!+k)/n;if(floor(s)==s,if(ispseudoprime(s),return(k))))
    n=1;while(n<100,print1(a(n),", ");n++)

Formula

a(n) = n*A033932(n-1), except a(3) = 0 where A033932 demands positive values. - Jens Kruse Andersen, Jul 30 2014

A339274 Number of times the n-th prime (=A000040(n)) occurs in A033933.

Original entry on oeis.org

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

Views

Author

A.H.M. Smeets, Dec 25 2020

Keywords

Comments

Each term in A033933 is either 1 or a prime number. Moreover it is known that each prime occurs only a finite number of times in A033933.
By excluding the terms that equal one from A033933, we observe the smallest value of A033933(n)/log(n!) in the range n = 3..2000 to be ~0.1552. From this it is believed that the primes less than 0.9*log(2001!)*0.1552 (~ 1846) will not occur anymore in the sequence A033933 for n > 2000; the applied factor 0.9 is a safety factor to be more or less sure that the prime numbers up to about 1846 will no longer occur in A033933.

Examples

			The prime number 13 occurs 2 times in A033933, and A000040(6) = 13, so a(6) = 2.
		

Crossrefs

See also A340006, A340007 (p#).

Formula

It seems that Sum_{k = 1..n} a(k) ~ 0.7*A000040(n)/log(log(A000040(n))).

A340013 The prime gap, divided by two, which surrounds n!.

Original entry on oeis.org

1, 3, 7, 4, 6, 27, 15, 11, 7, 15, 45, 10, 45, 38, 45, 39, 95, 30, 31, 52, 93, 102, 95, 48, 22, 84, 127, 54, 94, 40, 19, 145, 87, 129, 49, 22, 85, 68, 66, 88, 90, 78, 146, 95, 156, 78, 71, 79, 225, 60, 65, 175, 66, 305, 192, 196, 215, 205, 420, 101, 186, 213, 160
Offset: 3

Views

Author

Robert G. Wilson v, Jan 09 2021

Keywords

Comments

A theorem states that between (n+1)! + 2 and (n+1)! + (n+1) inclusive, there are n consecutive composite integers, namely 2, 3, 4, ..., n, n+1.
Records: 1, 3, 7, 27, 45, 95, 102, 127, 145, 146, 156, 225, 305, 420, 804, 844, 1173, 1671, 1725, 1827, 2570, 2930, 3318, 5142, 5946, 6837, 7007, 8208, 10221, ..., .

Examples

			For a(1), there are no positive primes which surround 1!. Therefore a(1) is undefined.
For a(2), there are two contiguous primes {2, 3} with 2 being 2!. The prime gap is 1. However, the two primes do not surround 2!, so a(2) is undefined.
For a(3), the following set of numbers, {5, 6, 7}, with 3! being in the middle. The prime gap is 2; therefore, a(3) = 1.
For a(4), the following set of numbers, {23, 24, 25, 26, 27, 28, 29} with 4! in between the two primes 23 & 29. The prime gap is 6, so a(4) = 3.
		

Crossrefs

Programs

  • Maple
    a:= n-> (f-> (nextprime(f-1)-prevprime(f+1))/2)(n!):
    seq(a(n), n=3..70);  # Alois P. Heinz, Jan 09 2021
  • Mathematica
    a[n_] := (NextPrime[n!, 1] - NextPrime[n!, -1])/2; Array[a, 70, 3]
  • PARI
    a(n) = (nextprime(n!+1) - precprime(n!-1))/2; \\ Michel Marcus, Jan 11 2021
    
  • Python
    from sympy import factorial, nextprime, prevprime
    def A340013(n):
        f = factorial(n)
        return (nextprime(f)-prevprime(f))//2 # Chai Wah Wu, Jan 23 2021

Formula

a(n) = (A037151(n) - A006990(n))/2 = (A033932(n) + A033933(n))/2.
a(n) = A054588(n)/2 = A058054(n)/2. - Alois P. Heinz, Jan 09 2021

A343717 a(n) is the smallest number that yields a prime when appended to n!.

Original entry on oeis.org

1, 1, 3, 1, 1, 1, 7, 11, 29, 17, 43, 29, 13, 47, 19, 73, 37, 19, 41, 103, 41, 31, 43, 1, 113, 31, 37, 59, 41, 53, 41, 47, 1, 41, 149, 37, 53, 73, 337, 1, 103, 151, 293, 47, 107, 509, 127, 71, 167, 197, 167, 149, 67, 163, 139, 251, 59, 107, 241, 331, 269, 1, 149
Offset: 0

Views

Author

Jon E. Schoenfield, May 17 2021

Keywords

Comments

Appending to n! any number k <= n yields a multiple of k; that multiple cannot be prime except at k=1, so, for every n, a(n)=1 or a(n) > n.
a(n) = 1 iff n = 0 or n is in A024912.
See A068695 for a proof that a(n) always exists. - Felix Fröhlich, May 18 2021
If a(n) is composite, then a(n) > 2n. - Michael S. Branicky, May 18 2021

Examples

			n=1: 1! = 1; appending a 1 yields 11, a prime, so a(1)=1.
n=2: 2! = 2; appending a 1 yields 21 = 3*7, and appending a 2 yields 22 = 2*11, but appending a 3 yields 23 (a prime), so a(2)=3.
n=19: 19! = 121645100408832000; appending any number < 103 yields a composite, but 121645100408832000103 is a prime, so a(19)=103.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; local k, t; t:= n!;
          for k while not isprime(parse(cat(t, k))) do od; k
        end:
    seq(a(n), n=0..62);  # Alois P. Heinz, May 17 2021
  • Mathematica
    Array[Block[{m = #!, k = 0}, While[! PrimeQ[10^If[k == 0, 1, IntegerLength[k]]*m + k], k++]; k] &, 62] (* Michael De Vlieger, May 17 2021 *)
    snp[n_]:=Module[{nf=n!,c=1},While[!PrimeQ[nf*10^IntegerLength[c]+c],c++];c]; Array[snp,70,0] (* Harvey P. Dale, Oct 17 2024 *)
  • PARI
    for(n=0,62,my(f=digits(n!));forstep(k=1,oo,2,my(p=fromdigits(concat(f,digits(k))));if(ispseudoprime(p),print1(k,", ");break))) \\ Hugo Pfoertner, May 18 2021
  • Python
    # see link for faster program producing b-file
    from sympy import factorial, isprime
    def a(n):
      start = str(factorial(n))
      end = 1
      while not isprime(int(start + str(end))): end += 2
      return end
    print([a(n) for n in range(63)]) # Michael S. Branicky, May 17 2021
    

Formula

a(n) = A068695(n!) = A068695(A000142(n)).

A053712 Lower balancing primes to prime-balanced factorials.

Original entry on oeis.org

5, 113, 3628789, 51090942171709439969
Offset: 1

Views

Author

Labos Elemer, Feb 10 2000

Keywords

Comments

The next two terms are 171!-397 and 190!-409. - Jud McCranie, Jul 04 2000

Examples

			113 is balancing 5! = 120 from below, where 5! = 120 is a balanced factorial.
		

Crossrefs

Formula

a(n) = A053709(n)! - A053711(n) = A053710(n) - A053711(n). - Amiram Eldar, Mar 10 2025

A053713 Upper balancing primes to prime-balanced factorials.

Original entry on oeis.org

7, 127, 3628811, 51090942171709440031
Offset: 1

Views

Author

Labos Elemer, Feb 10 2000

Keywords

Comments

The next two terms are 171!+397 and 190!+409, which are too large to include. - Jud McCranie, Jul 04 2000

Examples

			127 is balancing 5! = 120 from above, where 5! = 120 is a balanced factorial.
		

Crossrefs

Formula

a(n) = A053709(n)! + A053711(n) = A053710(n) + A053711(n). - Amiram Eldar, Mar 10 2025

A053708 Nearest prime to n! (but not equal to n!).

Original entry on oeis.org

2, 3, 5, 23, 113, 719, 5039, 40343, 362867, 3628789, 39916801, 479001599, 6227020777, 87178291199, 1307674368043, 20922789888023, 355687428096031, 6402373705728037, 121645100408832089, 2432902008176640029, 51090942171709439969, 1124000727777607680031, 25852016738884976639911
Offset: 1

Views

Author

Labos Elemer, Feb 10 2000

Keywords

Comments

If n! is the average of its closest prime neighbors then the smaller prime is to be chosen (as in A051701).

Examples

			For 8! = 40320 the closest upper and lower primes are 40289 and 40343 with d = 31 and d = 23, so 40343 is closer to 8! than the lower neighbor.
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=Module[{nf=n!,s,l},s=NextPrime[nf,-1];l=NextPrime[nf];If[nf-s>l-nf,l,s]]
    Table[f[i],{i,25}] (* Harvey P. Dale, Dec 08 2010 *)

Extensions

Corrected by Rick L. Shepherd, Jan 11 2006
a(21)-a(23) from Amiram Eldar, Mar 10 2025

A108518 a(n) is the smallest natural number m such that (10^n)! + m is prime.

Original entry on oeis.org

1, 11, 229, 1283, 44159
Offset: 0

Views

Author

Farideh Firoozbakht, Jul 10 2005

Keywords

Comments

If a(n) is composite then a(n)>10^(2n)+2*10^n. Conjecture: All terms are noncomposite numbers.
(10^4)!+44159 is a probable prime. - Jason Yuen, May 20 2024

Examples

			a(3)=1283 because (10^3)!+1283 is prime and for 0<m<1283 1000!+m is
composite.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := (For[m = 1, ! PrimeQ[(10^n)! + m], m++ ]; m); Do[Print[a[n]], {n, 0, 3}]
    sp[n_]:=Module[{c=(10^n)!},NextPrime[c]-c]; Array[sp,4,0] (* Harvey P. Dale, Jul 29 2013 *)

Formula

a(n) = A033932(10^n). - Jason Yuen, May 20 2024

Extensions

a(4) from Jason Yuen, May 20 2024
Previous Showing 11-20 of 23 results. Next