The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A059717 Start with decimal expansion of n; if all digits have the same parity, stop; otherwise write down the number formed by the even digits and the number formed by the odd digits and add them; repeat. 4
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 11, 3, 13, 5, 15, 7, 17, 9, 19, 20, 3, 22, 5, 24, 7, 26, 9, 28, 11, 3, 31, 5, 33, 7, 35, 9, 37, 11, 39, 40, 5, 42, 7, 44, 9, 46, 11, 48, 13, 5, 51, 7, 53, 9, 55, 11, 57, 13, 59, 60, 7, 62, 9, 64, 11, 66, 13, 68, 15, 7, 71, 9, 73, 11, 75 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
a(A011557(n)) = 1; a(A059708(n)) = A059708(n). [Reinhard Zumkeller, Jul 05 2011]
LINKS
EXAMPLE
For example, 59708 -> (0)8 + 597 = 605 -> 60 + 5 = 65 -> 6 + 5 = 11, stop, so a(59708) = 11.
MATHEMATICA
f[n_] := (id = IntegerDigits[n]; oddDigits = Select[id, OddQ]; evenDigits = Select[id, EvenQ]; Which[ oddDigits == {}, FromDigits[ evenDigits ], evenDigits == {}, FromDigits[ oddDigits ], True, FromDigits[ evenDigits ] + FromDigits[ oddDigits ]]); a[n_] := FixedPoint[f, n]; Table[a[n], {n, 0, 75}] (* Jean-François Alcover, May 31 2013 *)
PROG
(Haskell)
import Data.List (unfoldr)
a059717 n = if u == n || v == n then n else a059717 (u + v) where
(u, v) = foldl (\(x, y) d -> if odd d then (10*x+d, y) else (x, 10*y+d))
(0, 0) $ reverse $ unfoldr
(\z -> if z == 0 then Nothing else Just $ swap $ divMod z 10) n
-- Reinhard Zumkeller, Nov 16 2011 (corrected), Jul 05 2011
CROSSREFS
Sequence in context: A055483 A331472 A364362 * A004185 A068636 A328131
KEYWORD
nonn,base,easy,nice,look
AUTHOR
N. J. A. Sloane, Feb 08 2001
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 June 13 17:32 EDT 2024. Contains 373391 sequences. (Running on oeis4.)