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.

A072140 The period length of the 'Reverse and Subtract' trajectory of n is greater than 1.

This page as a plain text file.
%I A072140 #14 Jul 22 2025 16:32:31
%S A072140 1012,1023,1034,1045,1067,1078,1089,1100,1122,1133,1144,1155,1177,
%T A072140 1188,1199,1210,1232,1243,1254,1265,1287,1298,1320,1342,1353,1364,
%U A072140 1375,1397,1408,1430,1452,1463,1474,1485,1507,1518,1540,1562,1573,1584,1595,1606
%N A072140 The period length of the 'Reverse and Subtract' trajectory of n is greater than 1.
%C A072140 '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 A072140 Ray Chandler, <a href="/A072140/b072140.txt">Table of n, a(n) for n = 1..10000</a>
%e A072140 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 A072140 (Haskell)
%o A072140 import Data.List (find, findIndices, inits)
%o A072140 import Data.Maybe (fromJust)
%o A072140 spanCycle :: Eq a => (a -> a) -> a -> ([a],[a])
%o A072140 spanCycle f x = fromJust $ find (not . null . snd) $
%o A072140                            zipWith (span . (/=)) xs $ inits xs
%o A072140                 where xs = iterate f x
%o A072140 a072140_list = findIndices (> 1) $
%o A072140                map (length . snd . spanCycle (abs . a056965)) [0..]
%o A072140 -- eop.
%o A072140 -- _Reinhard Zumkeller_, Oct 24 2010
%Y A072140 Cf. A023108, A072137, A072141, A072142, A072143.
%K A072140 base,nonn
%O A072140 1,1
%A A072140 _Klaus Brockhaus_, Jun 24 2002