[go: up one dir, main page]

login
A065318
24 'Reverse and Add' steps are needed to reach a palindrome.
10
89, 98, 16991, 17981, 18971, 19961, 26990, 27980, 28970, 29960, 50169, 51159, 52149, 53139, 54129, 55119, 56109, 56199, 57189, 58179, 59169, 60168, 60649, 61158, 61639, 62148, 62629, 63138, 63619, 64128, 64609, 64699, 65118, 65689, 66108, 66198, 66679, 67188, 67669, 68178, 68659, 69168, 69649, 70167, 70648, 71157, 71638, 72147, 72628, 73618, 74127, 74608, 74698, 75117, 75688, 76107, 76197, 76678, 77187, 77668, 78177, 78658, 79167, 79648, 80166, 80339, 80499
OFFSET
1,1
COMMENTS
The number of steps starts at 0, so palindromes (cf. A002113) are excluded. 24 is a record (cf. A065199) of the number of 'Reverse and Add' steps needed to reach a palindrome.
MATHEMATICA
palQ[n_]:=Module[{idn=IntegerDigits[n]}, idn==Reverse[idn]]; With[{tstx =Join[Table[False, {24}], {True}]}, tstQ[n_]:=palQ/@NestList[#+FromDigits[ Reverse[IntegerDigits[#]]]&, n, 24]==tstx]; Select[Range[100000], tstQ] (* Harvey P. Dale, Nov 26 2010, Sep 30 2011 *)
lenQ[n_]:= Length[NestWhileList[# + FromDigits[Reverse[IntegerDigits[#]]]&, n, #!= FromDigits[Reverse[IntegerDigits[#]]]&, 1, 25]] == 25; Select[Range[100000], lenQ] (* Vincenzo Librandi, Sep 24 2013 *)
PROG
(ARIBAS): function revaddi_steps(k, start, up: integer); var n, m, steps, rev: integer; begin for n := start to up do m := n; rev := int_reverse(m); steps := 0; while steps < k and m <> rev do m := m + rev; rev := int_reverse(m); inc(steps); end; if steps = k and m = rev then write(n, " "); end; end; end; revaddi_steps(24, 0, 66200).
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Klaus Brockhaus, Oct 30 2001
EXTENSIONS
Additional terms from Harvey P. Dale, Nov 26 2010
Changed offset from 0 to 1 by Vincenzo Librandi, Sep 24 2013
STATUS
approved