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!)
A108234 Minimum m such that n*2^m+k is prime, for k < 2^m. In other words, assuming you've read n out of a binary stream, a(n) is the minimum number of additional bits (appended to the least significant end of n) you must read before it is possible to obtain a prime. 4
1, 0, 0, 2, 0, 1, 0, 1, 1, 2, 0, 3, 0, 1, 1, 2, 0, 1, 0, 1, 1, 2, 0, 2, 2, 1, 2, 2, 0, 1, 0, 2, 1, 2, 1, 1, 0, 3, 1, 2, 0, 3, 0, 1, 2, 3, 0, 1, 2, 1, 1, 2, 0, 1, 2, 1, 2, 2, 0, 2, 0, 2, 1, 2, 1, 4, 0, 1, 1, 2, 0, 3, 0, 1, 1, 2, 2, 1, 0, 3, 1, 2, 0, 2, 3, 1, 2, 2, 0, 1, 2, 3, 2, 2, 1, 1, 0, 1, 1, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,4
COMMENTS
Somewhat related to the Riesel problem, A040081, the minimum m such that n*2^m-1 is prime.
LINKS
EXAMPLE
a(12) = 3 because 12 = 1100 in binary and 97 = 1100001 is the first prime that starts with 1100, needing 3 extra bits.
PROG
(Octave/MATLAB) for n=1:100; m=0; k=0; while(~isprime(n*2^m+k))k=k+1; if k==2^m k=0; m=m+1; end; end; x(n)=m; end; x
(PARI) A108234(n) = { my(m=0, k=0); while(!isprime((n*2^m)+k), k=k+1; if(2^m==k, k=0; m=m+1)); m; }; \\ Antti Karttunen, Dec 16 2017, after Octave/MATLAB code
CROSSREFS
Cf. A040081, A091991, A164022 (smallest prime).
Sequence in context: A066416 A292342 A091991 * A324572 A153148 A091830
KEYWORD
easy,nonn
AUTHOR
Mike Stay, Jun 16 2005
EXTENSIONS
Definition clarified by Antti Karttunen, Dec 16 2017
STATUS
approved

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 May 16 00:16 EDT 2024. Contains 372549 sequences. (Running on oeis4.)