[go: up one dir, main page]

login
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.
5
2, 37, 599, 153437, 628479869
OFFSET
1,1
COMMENTS
Primes in A139102.
a(6) > 10^14632 if it exists (no further primes in first 5000 terms of A139102). - Michael S. Branicky, Jan 25 2022
MATHEMATICA
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 *)
PROG
(PARI) 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, ", ")));
(Python) # uses agen() in A139102
from sympy import isprime
print(list(islice(filter(isprime, agen()), 5))) # Michael S. Branicky, Jan 25 2022
KEYWORD
nonn,base,more
AUTHOR
Omar E. Pol, Apr 11 2008
EXTENSIONS
a(5) from Robert Price, Apr 03 2019
STATUS
approved