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

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A037904 Greatest digit of n - least digit of n. 23
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 9 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,13
COMMENTS
a(n) = A054055(n)-A054054(n); a(A010785(n)) = 0; for k>0: a(n) = a(n*10^k + A000030(n)) = a(n*10^k + A010879(n)) = a(n*10^k + A054054(n)) = a(n*10^k + A054055(n)) . - Reinhard Zumkeller, Dec 14 2007; corrected by David Wasserman, May 21 2008
LINKS
MAPLE
f:= n -> (max-min)(convert(n, base, 10)):
map(f, [$1..1000]); # Robert Israel, Jul 07 2016
MATHEMATICA
f[n_] := Block[{d = IntegerDigits[n]}, Max[d] - Min[d]]; Table[ f[n], {n, 1, 15}]
PROG
(Haskell)
a037904 = f 9 0 where
f u v 0 = v - u
f u v z = f (min u d) (max v d) z' where (z', d) = divMod z 10
-- Reinhard Zumkeller, Dec 16 2013
(PARI) a(n)=my(d=digits(n)); vecmax(d)-vecmin(d) \\ Charles R Greathouse IV, Feb 07 2017
(Python)
def A037904(n): return int(max(s:=str(n)))-int(min(s)) # Chai Wah Wu, Nov 10 2023
CROSSREFS
Sequence in context: A030108 A307651 A297330 * A070615 A040114 A064834
KEYWORD
nonn,base,nice
AUTHOR
EXTENSIONS
Incorrect comments deleted by Robert Israel, Jul 07 2016
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 April 28 17:34 EDT 2024. Contains 372092 sequences. (Running on oeis4.)