login
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.
11

%I #25 Jan 10 2022 06:52:08

%S 1,10,1001,100101,1001010111,100101011101,1001010111010111,

%T 100101011101011101,1001010111010111010111,

%U 1001010111010111010111011111,100101011101011101011101111101,100101011101011101011101111101011111,1001010111010111010111011111010111110111

%N 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.

%C a(n) has A000040(n)-1 digits, n-1 digits "0" and A000040(n)-n digits "1".

%H Michael S. Branicky, <a href="/A139101/b139101.txt">Table of n, a(n) for n = 1..168</a>

%H Omar E. Pol, <a href="http://polprimos.com">Determinacion geometrica de los numeros primos y perfectos</a>.

%t Table[ sum = 0; For[i = 1, i <= Prime[n] - 1 , i++, sum = sum*2;

%t If[! PrimeQ[i], sum++]]; IntegerString[sum, 2], {n, 1, 13}] (* _Robert Price_, Apr 03 2019 *)

%o (PARI) a(n) = fromdigits(vector(prime(n)-1, k, !isprime(k)), 10); \\ _Michel Marcus_, Apr 04 2019

%o (Python)

%o from sympy import isprime, prime

%o def a(n): return int("".join(str(1-isprime(i)) for i in range(1, prime(n))))

%o print([a(n) for n in range(1, 14)]) # _Michael S. Branicky_, Jan 10 2022

%o (Python) # faster version for initial segment of sequence

%o from sympy import isprime

%o from itertools import count, islice

%o def agen(): # generator of terms

%o an = 0

%o for k in count(1):

%o an = 10 * an + int(not isprime(k))

%o if isprime(k+1):

%o yield an

%o print(list(islice(agen(), 13))) # _Michael S. Branicky_, Jan 10 2022

%Y Binary representation of A139102.

%Y Subset of A118256.

%Y Cf. A000040, A018252, A139103, A139104, A139119, A139120, A139122.

%K nonn,base

%O 1,2

%A _Omar E. Pol_, Apr 08 2008