A345325 Number of primes less than 10^n with digits in nondecreasing order.
0, 4, 16, 50, 132, 315, 689, 1413, 2636, 4967, 8563, 14481, 23593, 37127, 56809, 86779, 127096, 184517, 264288, 368794, 510442, 707483, 948307, 1268871, 1689642, 2204795, 2866855, 3729223, 4738019, 6013021, 7619227, 9510372, 11832748, 14770667, 18067652
Offset: 0
Links
Programs
-
Mathematica
Table[Length@Select[Prime@Range[PrimePi[10^n]],OrderedQ@IntegerDigits@#&],{n,0,7}] (* Giorgos Kalogeropoulos, Jul 22 2021 *)
-
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("123456789", 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
Extensions
a(11)-a(34) from Michael S. Branicky, Jul 22 2021
Comments