login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A116066
Numbers k such that both k and the k-th prime have nondecreasing digits.
4
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, 68, 69, 77, 88, 123, 188, 189, 222, 229, 237, 239, 246, 247, 249, 266, 278, 333, 336, 337, 345, 346, 348, 355, 357, 367, 388, 477, 489, 499, 669, 1117, 1346, 1347, 1348
OFFSET
1,2
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..97 (all terms < 10^9)
EXAMPLE
p(237) = 1489.
MATHEMATICA
Select[Range[1500], Min[Differences[IntegerDigits[#]]]>=0&&Min[ Differences[ IntegerDigits[Prime[#]]]]>=0&] (* Harvey P. Dale, May 14 2019 *)
PROG
(Python)
from sympy import sieve
from itertools import count, islice, combinations_with_replacement as mc
def nd(n): s = str(n); return s == "".join(sorted(s))
def bgen(d): yield from map(int, ("".join(m) for m in mc("123456789", d)))
def agen():
for d in count(1):
yield from (k for k in bgen(d) if nd(sieve[k]))
print(list(islice(agen(), 60))) # Michael S. Branicky, Jun 26 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Giovanni Resta, Feb 13 2006
STATUS
approved