|
|
A345326
|
|
Number of primes less than 10^n with digits in nonincreasing order.
|
|
2
|
|
|
0, 4, 14, 49, 125, 296, 646, 1304, 2459, 4543, 7882, 13272, 21856, 34934, 53446, 82055, 121322, 175498, 251714, 354810, 488440, 676065, 914834, 1220629, 1627770, 2135954, 2759889, 3590609, 4602572, 5830588, 7386200, 9266652, 11469407, 14314939, 17658240
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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)))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,hard
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|