A139101
Numbers that show 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, 10, 1001, 100101, 1001010111, 100101011101, 1001010111010111, 100101011101011101, 1001010111010111010111, 1001010111010111010111011111, 100101011101011101011101111101, 100101011101011101011101111101011111, 1001010111010111010111011111010111110111
Offset: 1
-
Table[ sum = 0; For[i = 1, i <= Prime[n] - 1 , i++, sum = sum*2;
If[! PrimeQ[i], sum++]]; IntegerString[sum, 2], {n, 1, 13}] (* Robert Price, Apr 03 2019 *)
-
a(n) = fromdigits(vector(prime(n)-1, k, !isprime(k)), 10); \\ 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))))
print([a(n) for n in range(1, 14)]) # 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))
if isprime(k+1):
yield an
print(list(islice(agen(), 13))) # Michael S. Branicky, Jan 10 2022
A118255
a(1)=1, then a(n)=2*a(n-1) if n is prime, a(n)=2*a(n-1)+1 if n not prime.
Original entry on oeis.org
1, 2, 4, 9, 18, 37, 74, 149, 299, 599, 1198, 2397, 4794, 9589, 19179, 38359, 76718, 153437, 306874, 613749, 1227499, 2454999, 4909998, 9819997, 19639995, 39279991, 78559983, 157119967, 314239934, 628479869, 1256959738, 2513919477, 5027838955, 10055677911
Offset: 1
a(2) = 2*1 = 2 as 2 is prime;
a(3) = 2*2 = 4 as 3 is prime;
a(4) = 2*4+1 = 9 as 4 is composite;
a(5) = 2*9 = 18 as 5 is prime.
-
f:=proc(n) option remember; if n=1 then RETURN(1); fi; if isprime(n) then 2*f(n-1) else 2*f(n-1)+1; fi; end; # N. J. A. Sloane
-
nxt[{n_,a_}]:={n+1,If[PrimeQ[n+1],2a,2a+1]}; Transpose[NestList[nxt,{1,1},40]][[2]] (* Harvey P. Dale, Jan 22 2015 *)
Array[FromDigits[#, 2] &@ Array[Boole[! PrimeQ@ #] &, #] &, 34] (* Michael De Vlieger, Nov 01 2016 *)
-
from sympy import isprime, prime
def a(n): return int("".join(str(1-isprime(i)) for i in range(1, n+1)), 2)
print([a(n) for n in range(1, 35)]) # 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))
yield an
print(list(islice(agen(), 34))) # Michael S. Branicky, Jan 10 2022
A139103
Numbers that show 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
10, 100, 10010, 1001010, 10010101110, 1001010111010, 10010101110101110, 1001010111010111010, 10010101110101110101110, 10010101110101110101110111110, 1001010111010111010111011111010, 1001010111010111010111011111010111110, 10010101110101110101110111110101111101110
Offset: 1
-
Table[ sum = 0; For[i = 1, i <= Prime[n] , i++, sum = sum*2;
If[! PrimeQ[i], sum++]]; IntegerString[sum, 2], {n, 1, 20}] (* Robert Price, Apr 03 2019 *)
-
a(n) = fromdigits(vector(prime(n), k, !isprime(k)), 10); \\ Michel Marcus, Apr 04 2019
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 *)
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.
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-7 of 7 results.
Comments