login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A004186 Arrange digits of n in decreasing order. 29
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 21, 31, 41, 51, 61, 71, 81, 91, 20, 21, 22, 32, 42, 52, 62, 72, 82, 92, 30, 31, 32, 33, 43, 53, 63, 73, 83, 93, 40, 41, 42, 43, 44, 54, 64, 74, 84, 94, 50, 51, 52, 53, 54, 55, 65, 75, 85, 95, 60, 61, 62, 63, 64, 65, 66, 76, 86, 96, 70, 71, 72 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

COMMENTS

a(A009996(n)) = A009996(n). - Reinhard Zumkeller, Oct 31 2007

If we define "sortable primes" as prime numbers that remain prime when their digits are sorted in decreasing order, then all absolute primes (A003459) are sortable primes but not all sortable primes are absolute primes. For example, 113 is both sortable and absolute, and 313 is sortable but not absolute since its digits can be permuted to 133 = 7 * 19. - Alonso del Arte, Oct 05 2013

LINKS

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

EXAMPLE

a(19) = 91 because the digits of 19 being 1 and 9, arranged in decreasing order they are 9 and 1.

a(20) = 20 because the digits are already in decreasing order.

MAPLE

A004186 := proc(n)

    local dgs;

    convert(n, base, 10) ;

    dgs := sort(%) ;

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

end proc:

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

MATHEMATICA

sortDigitsDown[n_] := FromDigits@ Reverse@ Sort@ IntegerDigits@ n; Array[sortDigitsDown, 73, 0] (* Robert G. Wilson v, Aug 19 2011 *)

PROG

(PARI)

reconstruct(m) = {local(r); r=0; for(i=1, matsize(m)[2], r=r*10+m[i]); r}

A004186(n) = reconstruct(vecsort(digits(n), , 4))

\\ Michael B. Porter, Nov 11 2009

(PARI) a(n) = fromdigits(vecsort(digits(n), , 4)); \\ Joerg Arndt, Feb 24 2019

(Haskell)

import Data.List (sort)

a004186 = read . reverse . sort . show :: Integer -> Integer

-- Reinhard Zumkeller, Aug 19 2011

CROSSREFS

Cf. A004185, A004086, A009996, A064222, A194233, A032553, A032554, A028907, A028908.

Sequence in context: A321474 A225805 A068637 * A034704 A276512 A023792

Adjacent sequences:  A004183 A004184 A004185 * A004187 A004188 A004189

KEYWORD

nonn,base,look

AUTHOR

N. J. A. Sloane.

EXTENSIONS

More terms from Reinhard Zumkeller, Oct 31 2007

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified October 21 14:20 EDT 2019. Contains 328301 sequences. (Running on oeis4.)