OFFSET
0,2
COMMENTS
Number of primes with at most n digits arranged in nonincreasing order.
LINKS
MATHEMATICA
Table[Length@Select[Prime@Range[PrimePi[10^n]], OrderedQ@Reverse@IntegerDigits@#&], {n, 0, 7}] (* Giorgos Kalogeropoulos, Jul 22 2021 *)
PROG
(Python)
from sympy import isprime
from itertools import accumulate, combinations_with_replacement as mc
def numwithdigs(d):
if d == 0: return 0
nonincreasing = (int("".join(m)) for m in mc("987654321", d))
return len(list(filter(isprime, nonincreasing)))
def aupto(nn): return list(accumulate(numwithdigs(d) for d in range(nn+1)))
print(aupto(14)) # Michael S. Branicky, Jul 22 2021
CROSSREFS
KEYWORD
nonn,base,hard
AUTHOR
Ilya Gutkovskiy, Jul 22 2021
EXTENSIONS
a(12)-a(34) from Michael S. Branicky, Jul 22 2021
STATUS
approved