OFFSET
1,1
COMMENTS
'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.
LINKS
Ray Chandler, Table of n, a(n) for n = 1..10000
EXAMPLE
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.
PROG
Contribution from Reinhard Zumkeller, Oct 24 2010: (Start)
(Other) Haskell:
import Data.List (find, findIndices, inits)
import Data.Maybe (fromJust)
spanCycle :: Eq a => (a -> a) -> a -> ([a], [a])
spanCycle f x = fromJust $ find (not . null . snd) $
.......................... zipWith (span . (/=)) xs $ inits xs
............... where xs = iterate f x
a072140_list = findIndices (> 1) $
.............. map (length . snd . spanCycle (abs . a056965)) [0..]
-- eop. (End)
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Klaus Brockhaus, Jun 24 2002
STATUS
approved