%I #9 Aug 28 2015 09:35:26
%S 1012,1023,1034,1045,1067,1078,1089,1100,1122,1133,1144,1155,1177,
%T 1188,1199,1210,1232,1243,1254,1265,1287,1298,1320,1342,1353,1364,
%U 1375,1397,1408,1430,1452,1463,1474,1485,1507,1518,1540,1562,1573,1584,1595,1606
%N The period length of the 'Reverse and Subtract' trajectory of n is greater than 1.
%C 'Reverse and Subtract' (cf. A072137) is defined by x -> |x - reverse(x)|. There is no number k > 0 such that |k - reverse(k)| = k, so 0 is the only period with length 1. Consequently this sequence consists of the numbers n such that repeated application of 'Reverse and Subtract' does not lead to a palindrome. It is an analog of A023108, which uses 'Reverse and Add'. - A072141, A072142, A072143 give the numbers which generate periods of length 2, 14, 22 respectively.
%H Ray Chandler, <a href="/A072140/b072140.txt">Table of n, a(n) for n = 1..10000</a>
%e 1012 -> |1012 - 2101| = 1089 -> |1089 - 9801| = 8712 -> |8712 - 2178| = 6534 -> |6534 - 4356| = 2178 -> |2178 - 8712| = 6534; the period of the trajectory is 6534, 2178 and a palindrome is never reached.
%o Contribution from _Reinhard Zumkeller_, Oct 24 2010: (Start)
%o (Other) Haskell:
%o import Data.List (find, findIndices, inits)
%o import Data.Maybe (fromJust)
%o spanCycle :: Eq a => (a -> a) -> a -> ([a],[a])
%o spanCycle f x = fromJust $ find (not . null . snd) $
%o .......................... zipWith (span . (/=)) xs $ inits xs
%o ............... where xs = iterate f x
%o a072140_list = findIndices (> 1) $
%o .............. map (length . snd . spanCycle (abs . a056965)) [0..]
%o -- eop. (End)
%Y Cf. A023108, A072137, A072141, A072142, A072143.
%K base,nonn
%O 1,1
%A _Klaus Brockhaus_, Jun 24 2002
|