%I #12 Jun 27 2022 15:59:37
%S 1,2,3,4,5,6,7,8,9,12,15,17,19,22,24,33,34,35,37,39,46,48,49,55,57,59,
%T 68,69,77,88,123,188,189,222,229,237,239,246,247,249,266,278,333,336,
%U 337,345,346,348,355,357,367,388,477,489,499,669,1117,1346,1347,1348
%N Numbers k such that both k and the k-th prime have nondecreasing digits.
%H Michael S. Branicky, <a href="/A116066/b116066.txt">Table of n, a(n) for n = 1..97</a> (all terms < 10^9)
%e p(237) = 1489.
%t Select[Range[1500],Min[Differences[IntegerDigits[#]]]>=0&&Min[ Differences[ IntegerDigits[Prime[#]]]]>=0&] (* _Harvey P. Dale_, May 14 2019 *)
%o (Python)
%o from sympy import sieve
%o from itertools import count, islice, combinations_with_replacement as mc
%o def nd(n): s = str(n); return s == "".join(sorted(s))
%o def bgen(d): yield from map(int, ("".join(m) for m in mc("123456789", d)))
%o def agen():
%o for d in count(1):
%o yield from (k for k in bgen(d) if nd(sieve[k]))
%o print(list(islice(agen(), 60))) # _Michael S. Branicky_, Jun 26 2022
%Y Cf. A116067, A116068, A116069.
%K nonn,base
%O 1,2
%A _Giovanni Resta_, Feb 13 2006
|