|
|
A345325
|
|
Number of primes less than 10^n with digits in nondecreasing order.
|
|
2
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
COMMENTS
|
Number of primes with at most n digits arranged in nondecreasing order.
|
|
LINKS
|
|
|
MATHEMATICA
|
Table[Length@Select[Prime@Range[PrimePi[10^n]], OrderedQ@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("123456789", d))
return len(list(filter(isprime, nonincreasing)))
def aupto(nn): return list(accumulate(numwithdigs(d) for d in range(nn+1)))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,hard
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|