The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A057821 a(n) is the least nonnegative integer k such that 2^n - k is a safe prime. 6

%I #44 Jan 26 2023 20:01:32

%S 1,5,9,5,21,29,9,5,9,17,45,161,165,269,285,17,45,233,9,17,321,317,633,

%T 677,405,437,189,1385,69,209,9,641,849,137,45,401,381,437,1965,2201,

%U 741,1493,573,857,1485,5297,2709,161,465,473,1269,4805,789

%N a(n) is the least nonnegative integer k such that 2^n - k is a safe prime.

%C Previous name was: "Useful safe primes: a(n) = least nonnegative integer k such that 2^n - k is prime and (2^n-k-1)/2 is also prime". The resulting sequence of 2^n-k terms: 7, 11, 23, 59, 107, ..., are thus the largest safe primes smaller than 2^n (A243916), a subsequence of A005385. - _Michel Marcus_, Jan 08 2014

%H Mark Andreas, <a href="/A057821/b057821.txt">Table of n, a(n) for n = 3..5120</a> (first 3070 terms from Artsiom Palkounikau)

%o (PARI) a(n) = {my(k=0); until (isprime(2^n-k) && isprime((2^n-k-1)/2), k++); return (k);} \\ _Michel Marcus_, Jun 29 2013

%o (Python)

%o from sympy import isprime

%o def a(n):

%o k=0

%o while True:

%o k+=1

%o if isprime(2**n - k) and isprime((2**n - k - 1)//2): return k

%o print([a(i) for i in range(3, 21)]) # _Indranil Ghosh_, Jun 12 2017, after PARI code by _Michel Marcus_

%Y Cf. A005385, A013603, A243916.

%K nonn

%O 3,2

%A _Warren D. Smith_, Nov 23 2000

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 June 7 20:29 EDT 2024. Contains 373206 sequences. (Running on oeis4.)