login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A192367 Numbers k such that k! + 2*k + 1 is prime. 0

%I #35 Sep 08 2022 08:45:57

%S 0,2,3,5,6,18,44,113,2615,16914

%N Numbers k such that k! + 2*k + 1 is prime.

%C Some of the larger entries may only correspond to probable primes.

%e 6! + 2*6 + 1 = 733 is prime, so 6 is in the sequence.

%p select(p -> isprime(factorial(p) + 2*p + 1), [$0 .. 1000]) # _Reza K Ghazi_, Jul 11 2021

%t Select[Range[0, 1000], PrimeQ[#! + 2*# + 1] &] (* _Reza K Ghazi_, Jul 11 2021 *)

%o (Python)

%o factor=1;

%o for i in range(2,10000):

%o factor=factor*i

%o if is_probable_prime(factor+2*i+1): #A Miller-Rabin primality test, with k=10

%o print i

%o (Magma) [ n: n in [0..1000] | IsPrime(Factorial(n)+2*n+1) ]; // _Klaus Brockhaus_, Jul 02 2011

%o (PARI) for(n=0,10^5,N=n!+2*n+1;if(ispseudoprime(N),print1(n,", ")));

%o /* use isprime() for stricter checking */ /* _Joerg Arndt_, Jul 03 2011 */

%o (SageMath) [p for p in range(1000) if is_prime(factorial(p)+2*p+1)] # _Reza K Ghazi_, Jul 11 2021

%Y Cf. A073308 (k!+k+1 is prime).

%K hard,nonn

%O 1,2

%A _Julio Cesar Hernandez-Castro_, Jun 29 2011

%E 0 added by _Arkadiusz Wesolowski_, Jun 29 2011

%E a(9) from _Arkadiusz Wesolowski_, Jul 02 2011

%E a(10) from _Charles R Greathouse IV_, Oct 14 2011

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 22:18 EDT 2024. Contains 371782 sequences. (Running on oeis4.)