login
A069749
Number of primes less than 10^n containing only the digits 2 and 3 (A020458).
0
2, 3, 5, 7, 11, 18, 31, 44, 83, 135, 239, 436, 818, 1436, 2773, 4695, 9244, 17022, 32948, 58158, 116040, 214188, 423902, 791950, 1554834, 2904470, 5725780, 10536383, 21070698, 40748211, 79634658, 148530950, 296094802, 561919901
OFFSET
1,1
COMMENTS
a(22) / A006880(22) = 214188 / 201467286689315906290 =~ 10^-15. But out of the 2^22 candidates for primes, ~5% are.
MATHEMATICA
s = 0; Do[k = 0; While[k < 2^n, k++; If[p = FromDigits[ PadLeft[ IntegerDigits[k, 2], n] + 2]; PrimeQ[p], s++ ]]; Print[s], {n, 1, 22}]
With[{c=Select[Flatten[Table[FromDigits/@Tuples[{2, 3}, n], {n, 22}]], PrimeQ]}, Table[Count[c, _?(#<10^i&)], {i, 22}]] (* Harvey P. Dale, Mar 18 2016 *)
PROG
(Python)
from sympy import isprime
from itertools import count, islice, product
def agen(): # generator of terms
c = 2
for d in count(2):
yield c
for first in product("23", repeat=d-1):
t = int("".join(first) + "3")
if isprime(t): c += 1
print(list(islice(agen(), 20))) # Michael S. Branicky, May 23 2024
CROSSREFS
KEYWORD
base,nonn,more
AUTHOR
Robert G. Wilson v, Apr 22 2002
EXTENSIONS
a(23)-a(27) from Sean A. Irvine, May 17 2024
a(28)-a(34) from Michael S. Branicky, May 22 2024
STATUS
approved