cp's OEIS Frontend

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.

A059707 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 multiply them; repeat.

This page as a plain text file.
%I A059707 #17 Jul 07 2014 12:32:19
%S A059707 0,1,2,3,4,5,6,7,8,9,0,11,2,13,4,15,6,17,8,19,20,2,22,6,24,0,26,4,28,
%T A059707 8,0,31,6,33,2,35,8,37,24,39,40,4,42,2,44,20,46,28,48,8,0,51,0,53,20,
%U A059707 55,0,57,40,59,60,6,62,8,64,0,66,42,68,20,0,71,4,73,28,75,42
%N A059707 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 multiply them; repeat.
%C A059707 a(A059708(n)) = A059708(n). - _Reinhard Zumkeller_, Jun 15 2012
%H A059707 Reinhard Zumkeller, <a href="/A059707/b059707.txt">Table of n, a(n) for n = 0..10000</a>
%e A059707 89 -> 8*9 = 72 -> 7*2 = 14 -> 1*4 = 4, stop, so a(89) = 4.
%e A059707 33278 -> 28*337 = 9436 -> 46*93 = 4278 -> 42*78 -> 2996 -> 26*99 = 2574 -> 24*57 = 1368 -> 68*13 = 884, stop, so a(33278) = 884.
%t A059707 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 *)
%t A059707 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 *)
%o A059707 (Haskell)
%o A059707 import Data.List (unfoldr)
%o A059707 a059707 n = if u == n || v == n then n else a059707 (u * v) where
%o A059707    (u,v) = foldl (\(x,y) d -> if odd d then (10*x+d,y) else (x,10*y+d))
%o A059707         (0,0) $ reverse $ unfoldr
%o A059707         (\z -> if z == 0 then Nothing else Just $ swap $ divMod z 10) n
%o A059707 -- _Reinhard Zumkeller_, Jun 15 2012
%Y A059707 Cf. A059708, A059717.
%K A059707 nonn,base,easy,nice,look
%O A059707 0,3
%A A059707 _N. J. A. Sloane_, Feb 07 2001
%E A059707 a(50) corrected by _Reinhard Zumkeller_, Jun 15 2012