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.

A037153 a(n) = p-n!, where p is the smallest prime > n!+1.

This page as a plain text file.
%I A037153 #70 May 22 2022 14:31:19
%S A037153 2,3,5,5,7,7,11,23,17,11,17,29,67,19,43,23,31,37,89,29,31,31,97,131,
%T A037153 41,59,47,67,223,107,127,79,37,97,61,131,311,43,97,53,61,97,71,47,239,
%U A037153 101,233,53,83,61,271,53,71,223,71,149,107,283,293,271,769,131,271,67,193
%N A037153 a(n) = p-n!, where p is the smallest prime > n!+1.
%C A037153 Analogous to Fortunate numbers and like them, the entries appear to be primes. In fact, the first 1200 terms are primes. Are all terms prime?
%C A037153 a(n) is the first (smallest) m such that m > 1 and n!+ m is prime. The second such m is A087202(n). a(n) must be greater than nextprime(n)-1. - _Farideh Firoozbakht_, Sep 01 2003
%C A037153 Sequence A069941, which counts the primes between n! and n!+n^2, provides numerical evidence that the smallest prime p greater than n!+1 is a prime distance from n!; that is, p-n! is a prime number. For p-n! to be a composite number, p would have to be greater than n!+n^2, which would imply that A069941(n)=0. - _T. D. Noe_, Mar 06 2010
%C A037153 The first 4003 terms are prime. - _Dana Jacobsen_, May 10 2015
%H A037153 Ray Chandler and Dana Jacobsen, <a href="/A037153/b037153.txt">Table of n, a(n) for n = 1..4000</a> [first 1200 terms from Ray Chandler]
%H A037153 Antonín Čejchan, Michal Křížek, and Lawrence Somer, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL25/Krizek/krizek3.html">On Remarkable Properties of Primes Near Factorials and Primorials</a>, Journal of Integer Sequences, Vol. 25 (2022), Article 22.1.4.
%H A037153 Hisanori Mishima, <a href="http://www.asahi-net.or.jp/~KC2H-MSM/mathland/matha2/fact_prp.htm">Primes near to factorial</a>, Dec 2008.
%H A037153 Andy Nicol, <a href="/A037153/a037153_1.png">Line graphs of A037153 in order and ascending numerical order</a>
%t A037153 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_ *)
%o A037153 (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
%o A037153 (MuPAD) for n from 1 to 65 do f := n!:a := nextprime(f+2)-f:print(a) end_for; // _Zerinvary Lajos_, Feb 22 2007
%o A037153 (PARI) a(n)=nextprime(n!+2)-n! \\ _Charles R Greathouse IV_, Jul 02 2013; Corrected by _Dana Jacobsen_, May 10 2015
%o A037153 (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
%o A037153 (Python)
%o A037153 from sympy import factorial, nextprime
%o A037153 def a(n): fn = factorial(n); return nextprime(fn+1) - fn
%o A037153 print([a(n) for n in range(1, 66)]) # _Michael S. Branicky_, May 22 2022
%Y A037153 Cf. A087202, A005235, A033932.
%K A037153 nonn
%O A037153 1,1
%A A037153 _Jud McCranie_
%E A037153 Edited by _N. J. A. Sloane_, Mar 06 2010