A028864 Primes with digits in nondecreasing order.
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 37, 47, 59, 67, 79, 89, 113, 127, 137, 139, 149, 157, 167, 179, 199, 223, 227, 229, 233, 239, 257, 269, 277, 337, 347, 349, 359, 367, 379, 389, 449, 457, 467, 479, 499, 557, 569, 577, 599, 677, 1117, 1123, 1129
Offset: 1
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..10000 (terms n = 1..1000 from T. D. Noe)
Programs
-
Magma
[p:p in PrimesUpTo(1200)| Reverse(Intseq(p)) eq Sort(Intseq(p))]; // Marius A. Burtea, Nov 29 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 *)
-
PARI
select(n->n=digits(n); n==vecsort(n), primes(500)) \\ Charles R Greathouse IV, Mar 15 2014
-
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 A028864_list = list(islice(A028864_gen(),30)) # Chai Wah Wu, Dec 25 2023
-
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
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
Extensions
Definition corrected by Omar E. Pol, Mar 22 2012
Comments