A089381 L-th order palindromes with L > 2.
10917, 11907, 11997, 12987, 13977, 14967, 15957, 16947, 17937, 18927, 19917, 20997, 21834, 21987, 22977, 23814, 23967, 23994, 24957, 25497, 25947, 25974, 26487, 26937, 27477, 27927, 27954, 28467, 28917, 29457, 29907, 29934, 30915
Offset: 1
Examples
For most numbers, iterating P produces a cycle of length 2: e.g., 121 -> 242 -> 121 -> ... The sequence for 10917 is 10917, 82818, 41409, 131823, 459954, 229977, 1009899, 10998900, 5499450, 2749725, 8029197, 15948405, {66433356, 33216678, 16608339, 109989000, 54994500, 27497250, 13748625} where the numbers in the brackets repeat. There are 7 numbers inside the brackets so 10917 is a 7th-order palindrome.
References
- C. A. Pickover, Wonders of Numbers, Adventures in Mathematics, Mind and Meaning, Chapter 58, 'Emordnilap Numbers,' Oxford University Press, N.Y., 2001, pp. 142-144.
Programs
-
Mathematica
Step[n_] := If[ EvenQ[n], n/2, n + FromDigits[ Reverse[ IntegerDigits[n]]]]; cPalHash = 1013; clearArray = Array[{} &, cPalHash]; InsertCheck[n_, a_] := Module[{i = Mod[n, cPalHash] + 1}, a[[i]] = Append[ a[[i]], n]]; SetAttributes[ InsertCheck, HoldRest]; CheckArray[n_, a_] := MemberQ[ a[[Mod[n, cPalHash] + 1]], n]; SetAttributes[ CheckArray, HoldRest]; PalListHelper[n_, cTries_] := Module[ {ch = clearArray}, NestWhileList[ (InsertCheck[ #, ch]; Step[ # ]) &, n, Not[CheckArray[ #, ch]] &, 1, cTries]]; PalList[n_, cTries_] := Module[ {lst, nRemoved, loop}, lst = PalListHelper[n, cTries]; nRemoved = First[ First[ Position[ lst, lst[[ -1]]]]]; loop = Drop[ Take[ lst, {nRemoved, -1}], -1]; Append[ Take[ lst, {1, nRemoved - 1}], loop]]; Select[ Range[ 31000], Length[ PalList[ #, 1013][[ -1]]] > 2 &]
Extensions
Edited by Robert G. Wilson v and N. J. A. Sloane, Dec 31 2003
Comments