OFFSET
1,1
COMMENTS
Identical digits are acceptable, e.g., 1117 is in the sequence. - Harvey P. Dale, Aug 16 2011
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000 (terms n = 1..1000 from T. D. Noe)
FORMULA
Trivially, a(n) >> exp(n^(1/10)). - Charles R Greathouse IV, Mar 15 2014
prime(n) = A028905(n) if prime(n) is in this sequence. - Alonso del Arte, Nov 25 2019
MATHEMATICA
daoQ[n_] := Count[Differences[IntegerDigits[n]], _?(# < 0 &)] == 0; Select[Prime[Range[200]], daoQ] (* Harvey P. Dale, Aug 16 2011 *)
Select[Prime[Range[200]], Min[Differences[IntegerDigits[#]]]>-1&] (* Harvey P. Dale, Mar 02 2023 *)
PROG
(R) j=2; y=as.bigz(c()); while(j<1000) {
x=sort(as.numeric(strsplit(as.character(j), spl="")[[1]]), decr=F)
if(j==paste(x[x>0], collapse="")) y=c(y, j)
j=nextprime(j)
} // Christian N. K. Anderson, Apr 04 2013
(PARI) select(n->n=digits(n); n==vecsort(n), primes(500)) \\ Charles R Greathouse IV, Mar 15 2014
(Magma) [p:p in PrimesUpTo(1200)| Reverse(Intseq(p)) eq Sort(Intseq(p))]; // Marius A. Burtea, Nov 29 2019
(Python)
from itertools import count, islice, combinations_with_replacement
from sympy import isprime
def A028864_gen(): # generator of terms
yield from (2, 3, 5, 7)
a, b = {'1':0, '2':1, '3':1, '4':2, '5':2, '6':2, '7':2, '8':3, '9':3}, (1, 3, 7, 9)
for l in count(1):
for d in combinations_with_replacement('123456789', l):
k = 10*int(''.join(d))
for e in b[a[d[-1]]:]:
if isprime(m:=k+e):
yield m
CROSSREFS
KEYWORD
nonn,base,nice
AUTHOR
EXTENSIONS
Definition corrected by Omar E. Pol, Mar 22 2012
STATUS
approved