login
A217050
Number of primes of n base-3 digits such that each of the 3 digits (0, 1, 2) appears exactly a prime number of times.
0
0, 0, 0, 0, 0, 0, 42, 164, 349, 1400, 3414, 7816, 30166, 30315, 241385, 93803, 1621424, 256109, 9504808, 2382005, 58680809, 5173582, 442095498, 27083394, 3763874067, 227444355, 20058458866, 500609319
OFFSET
1,7
COMMENTS
We have a(n) = 0 for n < 7 because no prime represented in base 3 can have exactly two ones (or any larger even number).
EXAMPLE
The smallest number in the class concerned is 773, which is represented as 1001122 in base 3. There are 41 other 7-digit numbers with the same digits in base 3 that are also prime.
MATHEMATICA
Table[cnt = 0; Do[If[PrimeQ[i], d = IntegerDigits[i, 3]; c = Transpose[Tally[d]][[2]]; If[PrimeQ[c] == {True, True, True}, cnt++]], {i, 3^(n - 1), 3^n - 1}]; cnt, {n, 13}] (* T. D. Noe, Sep 27 2012 *)
PROG
(Python)
from sympy import primerange
from gmpy2 import is_prime, mpz
from sympy.utilities.iterables import multiset_permutations as mp
def a(n): return sum(1 for i in primerange(2, n-3)
for j in primerange(3, n-i-1)
if is_prime(k:=n-i-j)
for f in "12"
for m in mp(('0'*i+'1'*j+'2'*k).replace(f, '', 1))
if is_prime(mpz(f+"".join(m), 3)))
print([a(n) for n in range(1, 11)]) # Michael S. Branicky, Jul 21 2025
CROSSREFS
Sequence in context: A159226 A160329 A010022 * A134385 A232329 A115130
KEYWORD
nonn,base,more
AUTHOR
James G. Merickel, Sep 25 2012
EXTENSIONS
a(20)-a(22) from Chai Wah Wu, Nov 12 2015
a(23)-a(26) from Michael S. Branicky, Jul 21 2025
a(27)-a(28) from Michael S. Branicky, Aug 18 2025
STATUS
approved