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!)
A100634 a(n) is the decimal equivalent of the binary number whose k-th least significant bit is 1 iff k is a prime number and k <= n. 2
0, 2, 6, 6, 22, 22, 86, 86, 86, 86, 1110, 1110, 5206, 5206, 5206, 5206, 70742, 70742, 332886, 332886, 332886, 332886, 4527190, 4527190, 4527190, 4527190, 4527190, 4527190, 272962646, 272962646, 1346704470, 1346704470, 1346704470, 1346704470, 1346704470 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
1 is not considered prime. If 1 were to be considered prime, each term would be incremented by 1.
LINKS
Eric Weisstein's World of Mathematics, Least Significant Bit
EXAMPLE
a(5) = 22 because the k-th least significant bits 1,2,3,4,5 are prime for 2,3,5 and not prime for 1,4. So k=1->0, k=2->1, k=3->1, k=4->0 and k=5->1 gives the bit sequence 10110, which is 2 + 4 + 16 = 22 in its decimal expansion.
MAPLE
a:= proc(n) option remember; `if`(n<2, 0,
a(n-1)+`if`(isprime(n), 2^(n-1), 0))
end:
seq(a(n), n=1..35); # Alois P. Heinz, Apr 01 2024
MATHEMATICA
Table[FromDigits[Reverse[Table[If[PrimeQ[k] == True, 1, 0], {k, 1, N}]], 2], {N, 1, 40}]
FoldList[Plus, If[PrimeQ[#], 2^#/2, 0] & /@ Range@40] (* David Dewan, Apr 01 2024 *)
PROG
(PARI) Sum(an)={ L=#binary(an)-1; k=2; s=0; pow2=2;
forstep(j=L, 2, -1,
if(isprime(k), s+=pow2);
k++; pow2*=2);
return(s) };
n=1; an=0;
while(an<=1346704470,
an+=Sum(an); print1(an, ", "); n++;
while(!isprime(n), print1(an, ", "); n++);
an=2^(n-1)
) \\ Washington Bomfim, Jan 17 2011
CROSSREFS
Sequence in context: A258702 A320916 A119551 * A242527 A304680 A367765
KEYWORD
nonn,base
AUTHOR
Joseph Biberstine (jrbibers(AT)indiana.edu), Dec 02 2004
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 18 22:18 EDT 2024. Contains 371782 sequences. (Running on oeis4.)