This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A059717 #19 Jan 27 2014 10:21:13 %S A059717 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, %T A059717 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, %U A059717 55,11,57,13,59,60,7,62,9,64,11,66,13,68,15,7,71,9,73,11,75 %N 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. %C A059717 a(A011557(n)) = 1; a(A059708(n)) = A059708(n). [_Reinhard Zumkeller_, Jul 05 2011] %H A059717 Reinhard Zumkeller, <a href="/A059717/b059717.txt">Table of n, a(n) for n = 0..10000</a> %e A059717 For example, 59708 -> (0)8 + 597 = 605 -> 60 + 5 = 65 -> 6 + 5 = 11, stop, so a(59708) = 11. %t A059717 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 *) %o A059717 (Haskell) %o A059717 import Data.List (unfoldr) %o A059717 a059717 n = if u == n || v == n then n else a059717 (u + v) where %o A059717 (u,v) = foldl (\(x,y) d -> if odd d then (10*x+d,y) else (x,10*y+d)) %o A059717 (0,0) $ reverse $ unfoldr %o A059717 (\z -> if z == 0 then Nothing else Just $ swap $ divMod z 10) n %o A059717 -- _Reinhard Zumkeller_, Nov 16 2011 (corrected), Jul 05 2011 %Y A059717 Cf. A059707, A059708. %K A059717 nonn,base,easy,nice,look %O A059717 0,3 %A A059717 _N. J. A. Sloane_, Feb 08 2001