login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo

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 59th year, we have over 358,000 sequences, and we’ve crossed 10,300 citations (which often say “discovered thanks to the OEIS”).

Other ways to Give
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A004185 Arrange digits of n in increasing order, then (for n > 0) omit the zeros. 42
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 12, 22, 23, 24, 25, 26, 27, 28, 29, 3, 13, 23, 33, 34, 35, 36, 37, 38, 39, 4, 14, 24, 34, 44, 45, 46, 47, 48, 49, 5, 15, 25, 35, 45, 55, 56, 57, 58, 59, 6, 16, 26, 36, 46, 56, 66, 67, 68, 69, 7, 17, 27, 37, 47 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

COMMENTS

Record values: A009994. - Reinhard Zumkeller, Dec 05 2009

If we define "sortable primes" as prime numbers that remain prime when their digits are sorted in increasing order, then all absolute primes (A003459) are sortable primes but not all sortable primes are absolute primes. For example, 311 is both sortable and absolute, and 271 is sortable but not absolute, since its digits can be permuted to 217 = 7 * 31 or 712 = 2^3 * 89, etc. - Alonso del Arte, Oct 05 2013

The above mentioned "sortable primes" are listed in A211654, the nontrivial ones (with digits not in nondecreasing order) in A086042. - M. F. Hasler, Jul 30 2019

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 0..10000

EXAMPLE

a(19) = 19 because the digits are already in increasing order.

a(20) = 2 because the digits of 20 are 2 and 0, which in increasing order are 0 and 2, but since zero-padding is not allowed on the left, the zero digit is dropped and we are left with 2.

a(21) = 12 because the digits of 21 are 2 and 1, which in increasing order are 1 and 2.

MAPLE

A004185 := proc(n)

local dgs;

convert(n, base, 10) ;

dgs := sort(%, `>`) ;

add( op(i, dgs)*10^(i-1), i=1..nops(dgs)) ;

end proc:

seq(A004185(n), n=0..20) ; # R. J. Mathar, Jul 26 2015

MATHEMATICA

FromDigits[Sort[DeleteCases[IntegerDigits[#], 0]]]&/@Range[0, 60] (* Harvey P. Dale, Nov 29 2011 *)

PROG

(Haskell)

import Data.List (sort)

a004185 n = read $ sort $ show n :: Integer

-- Reinhard Zumkeller, Aug 10 2011

(Magma) A004185:=func<n | Seqint(Reverse(Sort(Intseq(n))))>; [n eq 0 select 0 else A004185(n): n in [0..57]]; // Bruno Berselli, Apr 03 2012

(Python)

def A004185(n):

return int(''.join(sorted(str(n))).replace('0', '')) if n > 0 else 0 # Chai Wah Wu, Nov 10 2015

(PARI) a(n)=fromdigits(vecsort(digits(n))) \\ Charles R Greathouse IV, Feb 06 2017

CROSSREFS

Cf. A004719, A004151, A004086, A004186, A009996, A221714, A073138, A193581, A193582, A065641.

Cf. A211654 (sortable primes) and subsequence A086042 (nontrivial solutions).

Sequence in context: A055483 A331472 A059717 * A068636 A328131 A004719

Adjacent sequences: A004182 A004183 A004184 * A004186 A004187 A004188

KEYWORD

nonn,base,nice,easy,look

AUTHOR

N. J. A. Sloane

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified December 7 21:25 EST 2022. Contains 358669 sequences. (Running on oeis4.)