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!)
A348292 Binary expansion of the smallest binary number starting with a(0)=1 that is prime when the final number is 1 and composite when the final number is 0. 0
1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 (list; constant; graph; refs; listen; history; text; internal format)
OFFSET
0
COMMENTS
The prime values generated by this sequence are also generated by A084435 (except for 2, which is only listed in A084435).
REFERENCES
Donald E. Knuth, The Art of Computer Programming, Vol. 2, Seminumerical Algorithms, problem 39, page 76.
LINKS
EXAMPLE
For example, the binary numbers 1, 11, and 111 expressed in base 10 are 1, 3, and 7, which are prime with the exception of the first term. The next term in the binary number must be 0 because the binary number 1111 is composite.
MATHEMATICA
seq[len_] := Module[{s = {1}, k = 1, m = 1, d}, While[k < len, m *= 2; d = Boole@PrimeQ[m + 1]; m += d; AppendTo[s, d]; k++]; s]; seq[100] (* Amiram Eldar, Oct 19 2021 *)
PROG
(HTML/JavaScript)
<html>
<script>
binary="1";
for(k=0; k<30; k++)
{
if(isprime(parseInt(binary+"1", 2))==true)
{
binary=binary+"1";
}
if(isprime(parseInt(binary+"1", 2))==false)
{
binary=binary+"0";
}
}
document.write(binary);
function isprime(x)
{
for(i=2; i<(x-1); i++)
{
if(x%i==0)
{
return false;
}
}
return true;
}
</script>
</html>
CROSSREFS
Cf. A084435.
Sequence in context: A284881 A090174 A165556 * A127243 A127248 A266298
KEYWORD
nonn,base,cons
AUTHOR
Michael R. Page, Oct 19 2021
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 April 24 12:20 EDT 2024. Contains 371937 sequences. (Running on oeis4.)