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.

A033932 Least positive m such that n! + m is prime.

Original entry on oeis.org

1, 1, 1, 1, 5, 7, 7, 11, 23, 17, 11, 1, 29, 67, 19, 43, 23, 31, 37, 89, 29, 31, 31, 97, 131, 41, 59, 1, 67, 223, 107, 127, 79, 37, 97, 61, 131, 1, 43, 97, 53, 1, 97, 71, 47, 239, 101, 233, 53, 83, 61, 271, 53, 71, 223, 71, 149, 107, 283, 293, 271, 769, 131, 271
Offset: 0

Views

Author

Keywords

Comments

Conjecture: No term is a composite number. a(n) is a prime > 3*prime(k), where k is such that prime(k) < n <= prime(k+1). - Amarnath Murthy, Apr 07 2004
Terms after n = 2000 in the b-file correspond to Fermat and Lucas PRP. - Phillip Poplin, Oct 12 2019

Crossrefs

Programs

  • Maple
    a:= n-> (f-> nextprime(f)-f)(n!):
    seq(a(n), n=0..70);  # Alois P. Heinz, Feb 22 2023
  • Mathematica
    a[n_] := (an = 1; While[ !PrimeQ[n! + an], an++]; an); Table[a[n], {n, 0, 63}] (* Jean-François Alcover, Dec 05 2012 *)
    NextPrime[#]-#&/@(Range[0,70]!) (* Harvey P. Dale, May 18 2014 *)
  • PARI
    for(n=0,70, k=1; while(!isprime(n!+k), k++); print1(k,","))
    
  • PARI
    a(n) = nextprime(n!+1) - n!; \\ Michel Marcus, Dec 25 2020
    
  • Python
    from sympy import factorial, nextprime
    def a(n): fn = factorial(n); return nextprime(fn) - fn
    print([a(n) for n in range(64)]) # Michael S. Branicky, May 22 2022

Formula

a(n) = A151800(n!) - n!. - Max Alekseyev, Jul 23 2014

Extensions

More terms from Jud McCranie
a(21) onwards from Wouter Meeussen
Better description from Rick L. Shepherd, Nov 06 2002

A033933 Least nonnegative m such that n! - m is prime.

Original entry on oeis.org

0, 1, 1, 7, 1, 1, 31, 13, 11, 13, 1, 23, 1, 47, 53, 59, 41, 101, 31, 31, 73, 89, 73, 149, 37, 43, 101, 31, 1, 61, 1, 1, 193, 113, 127, 97, 1, 73, 83, 131, 79, 109, 109, 53, 89, 79, 103, 59, 97, 179, 67, 59, 127, 61, 461, 277, 109, 137, 139, 71, 71, 101, 359, 127, 317, 191, 251, 103, 97, 751, 163, 373, 199, 167, 157, 491, 317
Offset: 2

Views

Author

Keywords

Comments

Conjecture: for n >= 3, a(n) is 1 or a prime. - Amarnath Murthy, Mar 19 2002
a(n) is not divisible by any prime <= n. If a(n) > 1 is composite, then a(n) > n^2. There are no entries up to n = 2000 with a(n) > n^2, and there may be none. - Robert Israel, Jul 20 2014

Crossrefs

Programs

  • Maple
    0, seq(n! - prevprime(n!), n=3..100); # Robert Israel, Jul 15 2014
  • Mathematica
    p[n_] := Module[{nf = n!}, nf - NextPrime[nf, -1]]; Join[{0}, Table[p[n], {n, 3, 70}]] (* Harvey P. Dale, Jul 07 2012 *)
  • PARI
    for(n=2,70, k=0; while(!isprime(n!-k), k++); print1(k,","))
    
  • PARI
    vector(66, t, my(n=t+1, f=n!); f-precprime(f)) \\ Joerg Arndt, Jul 19 2014
    
  • Sage
    def A033933(n):
        if n < 3: return 0
        f = factorial(n)
        return f - previous_prime(f)
    [A033933(n) for n in (2..78)] # Peter Luschny, Jul 20 2014

Extensions

More terms from Jud McCranie
a(21) onwards from Wouter Meeussen
Corrected by Rick L. Shepherd, Nov 06 2002

A056752 Distance from n! to the nearest prime.

Original entry on oeis.org

1, 0, 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
Offset: 1

Views

Author

Labos Elemer, Jan 19 2001

Keywords

Examples

			For both 1! and 2! the nearest prime neighbor is 2, with distances of 1 and 0, respectively. The nearest primes around 8! are 40289 and 40343 with distances of 31 and 23, so a(8)=23.
		

Crossrefs

Cf. A006990, A037151, A033932, A033933, A053714 (signed version with a different second term).

Programs

  • Maple
    with(numtheory): [seq(min(nextprime(i!)-i!,i!-prevprime(i!)),i=3..100)]; # a(1) and a(2) computed individually
  • Mathematica
    Table[Function[k, Min[k - #, NextPrime@ # - k] &@If[n == 1, 0, Prime@ PrimePi@ k]][n!], {n, 16}] (* Michael De Vlieger, Jul 15 2017 *)
Showing 1-3 of 3 results.