A038571 Number of times n must be differentiated to reach 0.
0, 1, 2, 1, 3, 2, 2, 1, 4, 3, 2, 3, 3, 2, 2, 1, 5, 4, 4, 3, 3, 2, 3, 4, 4, 3, 2, 3, 3, 2, 2, 1, 6, 5, 4, 5, 4, 5, 3, 4, 4, 3, 2, 3, 3, 4, 4, 5, 5, 4, 4, 3, 3, 2, 3, 4, 4, 3, 2, 3, 3, 2, 2, 1, 7, 6, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 3, 4, 4, 5, 5, 4, 4, 3, 3, 2, 3, 4, 4, 3, 5, 4, 5, 4, 5, 6, 6, 5, 4, 5, 4, 5, 3, 4, 4
Offset: 0
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Crossrefs
Cf. A038554.
Programs
-
Haskell
a038571 n = snd $ until ((== 0) . fst) (\(x, i) -> (fromIntegral $ a038554 x, i + 1)) (n, 0) -- Reinhard Zumkeller, Mar 06 2013
-
Mathematica
dtn[ L_ ] := Fold[ 2#1+#2&, 0, L ]; f[ n_ ] := dtn[ Map[ Abs[ #[ [ 1 ] ]-#[ [ 2 ] ] ]&, Partition[ IntegerDigits[ n, 2 ], 2, 1 ] ] ]; g[ n_ ] := Length[ FixedPointList[ f, n ] ]-2; Table[ g[ n ], {n, 0, 120} ]
Extensions
More terms from Erich Friedman