A037153 a(n) = p-n!, where p is the smallest prime > n!+1.
2, 3, 5, 5, 7, 7, 11, 23, 17, 11, 17, 29, 67, 19, 43, 23, 31, 37, 89, 29, 31, 31, 97, 131, 41, 59, 47, 67, 223, 107, 127, 79, 37, 97, 61, 131, 311, 43, 97, 53, 61, 97, 71, 47, 239, 101, 233, 53, 83, 61, 271, 53, 71, 223, 71, 149, 107, 283, 293, 271, 769, 131, 271, 67, 193
Offset: 1
Keywords
Links
- Ray Chandler and Dana Jacobsen, Table of n, a(n) for n = 1..4000 [first 1200 terms from Ray Chandler]
- Antonín Čejchan, Michal Křížek, and Lawrence Somer, On Remarkable Properties of Primes Near Factorials and Primorials, Journal of Integer Sequences, Vol. 25 (2022), Article 22.1.4.
- Hisanori Mishima, Primes near to factorial, Dec 2008.
- Andy Nicol, Line graphs of A037153 in order and ascending numerical order
Programs
-
Magma
z:=125; [p-f where p is NextPrime(f+1) where f is Factorial(n): n in [1..z]]; // Klaus Brockhaus, Mar 02 2010
-
Mathematica
NextPrime[ n_Integer ] := (k=n+1; While[ !PrimeQ[ k ], k++ ]; Return[ k ]); f[ n_Integer ] := (p = n! + 1; q = NextPrime[ p ]; Return[ q - p + 1 ]); Table[ f[ n ], {n, 1, 75} ] (* Robert G. Wilson v *)
-
MuPAD
for n from 1 to 65 do f := n!:a := nextprime(f+2)-f:print(a) end_for; // Zerinvary Lajos, Feb 22 2007
-
PARI
a(n)=nextprime(n!+2)-n! \\ Charles R Greathouse IV, Jul 02 2013; Corrected by Dana Jacobsen, May 10 2015
-
Perl
use ntheory ":all"; for my $n (1..1000) { my $f=factorial($n); say "$n ",next_prime($f+1)-$f; } # Dana Jacobsen, May 10 2015
-
Python
from sympy import factorial, nextprime def a(n): fn = factorial(n); return nextprime(fn+1) - fn print([a(n) for n in range(1, 66)]) # Michael S. Branicky, May 22 2022
Extensions
Edited by N. J. A. Sloane, Mar 06 2010
Comments