OFFSET
0,3
COMMENTS
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
EXAMPLE
89 -> 8*9 = 72 -> 7*2 = 14 -> 1*4 = 4, stop, so a(89) = 4.
33278 -> 28*337 = 9436 -> 46*93 = 4278 -> 42*78 -> 2996 -> 26*99 = 2574 -> 24*57 = 1368 -> 68*13 = 884, stop, so a(33278) = 884.
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, 76}] (* Jean-François Alcover, May 16 2013 *)
sp[n_]:=Module[{idn=IntegerDigits[n], e, o}, e=Select[idn, EvenQ]; o= Select[ idn, OddQ]; If[Min[Length[o], Length[e]]>0, FromDigits[o] FromDigits[e], n]]; Table[FixedPoint[sp, i], {i, 0, 80}] (* Harvey P. Dale, Jun 05 2014 *)
PROG
(Haskell)
import Data.List (unfoldr)
a059707 n = if u == n || v == n then n else a059707 (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, Jun 15 2012
CROSSREFS
KEYWORD
AUTHOR
N. J. A. Sloane, Feb 07 2001
EXTENSIONS
a(50) corrected by Reinhard Zumkeller, Jun 15 2012
STATUS
approved