A118256
Concatenation for i=1 to n of A005171(i); also A118255 in base 2.
Original entry on oeis.org
1, 10, 100, 1001, 10010, 100101, 1001010, 10010101, 100101011, 1001010111, 10010101110, 100101011101, 1001010111010, 10010101110101, 100101011101011, 1001010111010111, 10010101110101110, 100101011101011101, 1001010111010111010, 10010101110101110101, 100101011101011101011
Offset: 1
A005171 : 1,0,0,1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,1 ................
a(1)=1, a(2)=10, a(3)=100, a(4)=1001, ...
-
Array[FromDigits@ Array[Boole[! PrimeQ@ #] &, #] &, 21] (* or *)
FromDigits@ IntegerDigits[#, 2] & /@ Last@ Transpose@ NestList[{#1 + 1, If[PrimeQ[#1 + 1], 2 #2, 2 #2 + 1]} & @@ # &, {1, 1}, 21] (* Michael De Vlieger, Nov 01 2016, latter after Harvey P. Dale at A118255 *)
-
a(n) = sum(k=1, n, !isprime(k)*10^(n-k)); \\ Michel Marcus, Nov 01 2016
-
from sympy import isprime
def a(n): return int("".join(str(1-isprime(i)) for i in range(1, n+1)))
print([a(n) for n in range(1, 22)]) # Michael S. Branicky, Jan 10 2022
-
# faster version for initial segment of sequence
from sympy import isprime
from itertools import count, islice
def agen(): # generator of terms
an = 0
for k in count(1):
an = 10 * an + int(not isprime(k))
yield an
print(list(islice(agen(), 21))) # Michael S. Branicky, Jan 10 2022
A118257
Numbers k such that A118255(k) is prime.
Original entry on oeis.org
2, 6, 8, 10, 18, 26, 30, 74, 142, 203, 398, 651, 792, 1314, 3487, 5978, 6240, 7814, 8054, 8673, 21436, 23947, 52985, 91784, 157537, 164901
Offset: 1
A118255(2) = 2 prime, A118255(6) = 149 prime, A118255(8) = 599 prime.
A139102
Numbers whose binary representation shows the distribution of prime numbers up to the n-th prime minus 1, using "0" for primes and "1" for nonprime numbers.
Original entry on oeis.org
1, 2, 9, 37, 599, 2397, 38359, 153437, 2454999, 157119967, 628479869, 40222711647, 643563386359, 2574253545437, 41188056726999, 2636035630527967, 168706280353789919, 674825121415159677, 43188807770570219359, 691020924329123509751, 2764083697316494039005
Offset: 1
a(4)=37 because 37 written in base 2 is 100101 and the string "100101" shows the distribution of prime numbers up to the 4th prime minus 1, using "0" for primes and "1" for nonprime numbers.
-
A139101 := proc(n) option remember ; local a,p; if n = 1 then RETURN(1); else a := 10*A139101(n-1) ; for p from ithprime(n-1)+1 to ithprime(n)-1 do a := 10*a+1 ; od: fi ; RETURN(a) ; end: # R. J. Mathar, Apr 25 2008
bin2dec := proc(n) local nshft ; nshft := convert(n,base,10) ; add(op(i,nshft)*2^(i-1),i=1..nops(nshft) ) ; end: # R. J. Mathar, Apr 25 2008
A139102 := proc(n) bin2dec(A139101(n)) ; end: # R. J. Mathar, Apr 25 2008
seq(A139102(n),n=1..35) ; # R. J. Mathar, Apr 25 2008
-
Table[ sum = 0; For[i = 1, i <= Prime[n] - 1 , i++, sum = sum*2;
If[! PrimeQ[i], sum++]]; sum, {n, 1, 25}] (* Robert Price, Apr 03 2019 *)
-
a(n) = fromdigits(vector(prime(n)-1, k, !isprime(k)), 2); \\ Michel Marcus, Apr 04 2019
-
from sympy import isprime, prime
def a(n):
return int("".join(str(1-isprime(i)) for i in range(1, prime(n))), 2)
print([a(n) for n in range(1, 22)]) # Michael S. Branicky, Jan 10 2022
-
# faster version for initial segment of sequence
from sympy import isprime
from itertools import count, islice
def agen(): # generator of terms
an = 0
for k in count(1):
an = 2 * an + int(not isprime(k))
if isprime(k+1):
yield an
print(list(islice(agen(), 21))) # Michael S. Branicky, Jan 10 2022
A139104
Numbers whose binary representation shows the distribution of prime numbers up to the n-th prime, using "0" for primes and "1" for nonprime numbers.
Original entry on oeis.org
2, 4, 18, 74, 1198, 4794, 76718, 306874, 4909998, 314239934, 1256959738, 80445423294, 1287126772718, 5148507090874, 82376113453998, 5272071261055934, 337412560707579838, 1349650242830319354, 86377615541140438718, 1382041848658247019502, 5528167394632988078010
Offset: 1
a(4)=74 because 74 written in base 2 is 1001010 and the string "1001010" shows the distribution of prime numbers up to the 4th prime, using "0" for primes and "1" for nonprime numbers.
Cf.
A000040,
A018252,
A139101,
A139102,
A139103,
A139119,
A139120,
A139122,
A000720,
A001348,
A121240.
-
Table[ sum = 0; For[i = 1, i <= Prime[n] , i++, sum = sum*2;
If[! PrimeQ[i], sum++]]; sum, {n, 1, 21}] (* Robert Price, Apr 03 2019 *)
Module[{nn=30,t},t=Table[If[PrimeQ[n],0,1],{n,Prime[nn]}];Table[ FromDigits[ Take[t,p],2],{p,Prime[Range[nn]]}]] (* Harvey P. Dale, Jul 15 2019 *)
-
a(n) = fromdigits(vector(prime(n), k, !isprime(k)), 2); \\ Michel Marcus, Apr 04 2019
A072762
n coded as binary word of length=n with k-th bit set iff k is prime (1<=k<=n), decimal value.
Original entry on oeis.org
0, 1, 3, 6, 13, 26, 53, 106, 212, 424, 849, 1698, 3397, 6794, 13588, 27176, 54353, 108706, 217413, 434826, 869652, 1739304, 3478609, 6957218, 13914436, 27828872, 55657744, 111315488, 222630977, 445261954, 890523909, 1781047818, 3562095636, 7124191272
Offset: 1
a(6) = '011010' = (((0*2+1)*2+1)*2*2+1)*2 = 26.
a(7) = '0110101' = (((0*2+1)*2+1)*2*2+1)*2*2+1 = 53.
a(8) = '01101010' = ((((0*2+1)*2+1)*2*2+1)*2*2+1)*2 = 106.
-
a072762 n = foldl (\v d -> 2*v + d) 0 $ map a010051 [1..n]
-- Reinhard Zumkeller, Sep 17 2011
-
a:= proc(n) option remember;
`if`(n<2, 0, 2 * a(n-1) + `if`(isprime(n), 1, 0))
end:
seq(a(n), n=1..40); # Alois P. Heinz, Jan 18 2011
-
a[1] = 0; a[n_] := a[n] = 2*a[n-1] + Boole[PrimeQ[n]]; Table[a[n], {n, 1, 31}] (* Jean-François Alcover, Jun 14 2013 *)
nxt[{n_,a_}]:={n+1,Boole[PrimeQ[n+1]]+2a}; Transpose[NestList[nxt,{1,0},30]][[2]] (* Harvey P. Dale, Jan 07 2015 *)
-
an=0; print1(an,", "); for(n=2,31, an=2*an+isprime(n); print1(an,", ")) \\ Washington Bomfim, Jan 18 2011
-
a(n)=my(s=1,p=2);forprime(q=3,n,s=s<<(q-p)+1;p=q);s<<(n-p) \\ Charles R Greathouse IV, Jun 03 2013
A139119
Primes whose binary representation shows the distribution of prime numbers using "0" for primes and "1" for nonprime numbers.
Original entry on oeis.org
2, 37, 149, 599, 153437, 39279991, 628479869, 11056334789265976156021, 3263254052013454238294691704608897001027543, 7524551543123483484068003542235060639999919940760883731360687
Offset: 1
-
Select[Table[FromDigits[Boole /@ Not /@ PrimeQ /@ Range@k, 2], {k, 1, 100}], PrimeQ] (* Federico Provvedi, Oct 07 2013 *)
-
f(n) = fromdigits(vector(n, k, !isprime(k)), 2); \\ A118255
lista(nn) = for (n=1, nn, if (isprime(p=f(n)), print1(p, ", "))); \\ Michel Marcus, Apr 04 2019
A139120
Primes that show the distribution of prime numbers using "0" for primes and "1" for nonprime numbers.
Original entry on oeis.org
10010101, 1001010111010111, 100101011101011101011101111101011111011101011101111101111101011111011101011111011101111101111111011101011101011101111111111111011101111101011111111101011111011111011101111101111, 100101011101011101011101111101011111011101011101111101111101011111011101011111011101111101111111011101011101011101111111111111011101111101011111111101011111011111011101111101111101011111111101011101011111111
Offset: 1
-
A118255[n_] := Module[{},
If[n == 1, A118255[1] = 1,
If[PrimeQ[n], A118255[n] = 2 A118255[n - 1],
A118255[n] = 2 A118255[n - 1] + 1]]];
Select[Table[FromDigits[IntegerDigits[A118255[n], 2]], {n, 1, 1000}], PrimeQ] (* Robert Price, Apr 03 2019 *)
A139122
Primes whose binary representation shows the distribution of prime numbers up to some prime minus 1, using "0" for primes and "1" for nonprime numbers.
Original entry on oeis.org
2, 37, 599, 153437, 628479869
Offset: 1
-
Select[Table[ sum = 0; For[i = 1, i <= Prime[n] - 1 , i++, sum = sum*2; If[! PrimeQ[i], sum++]]; sum, {n, 1, 1000}], PrimeQ[#] &] (* Robert Price, Apr 03 2019 *)
Module[{nn=500,p,x},p=Table[If[PrimeQ[n],0,1],{n,nn}];x=SequencePosition[p,{1,0}][[All,1]];Join[{2},Select[Table[FromDigits[Take[p,k],2],{k,x}],PrimeQ]]] (* Harvey P. Dale, Jun 15 2022 *)
-
f(n) = fromdigits(vector(prime(n)-1, k, !isprime(k)), 2); \\ A139102
lista(nn) = for (n=1, nn, if (isprime(p=f(n)), print1(p, ", ")));
-
# uses agen() in A139102
from sympy import isprime
print(list(islice(filter(isprime, agen()), 5))) # Michael S. Branicky, Jan 25 2022
Showing 1-8 of 8 results.
Comments