|
|
A061563
|
|
Start with n; add to itself with digits reversed; if palindrome, stop; otherwise repeat; a(n) gives palindrome at which it stops, or -1 if no palindrome is ever reached.
|
|
9
|
|
|
0, 2, 4, 6, 8, 11, 33, 55, 77, 99, 11, 22, 33, 44, 55, 66, 77, 88, 99, 121, 22, 33, 44, 55, 66, 77, 88, 99, 121, 121, 33, 44, 55, 66, 77, 88, 99, 121, 121, 363, 44, 55, 66, 77, 88, 99, 121, 121, 363, 484, 55, 66, 77, 88, 99, 121, 121, 363, 484, 1111, 66, 77, 88, 99, 121
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
COMMENTS
|
It is believed that n = 196 is the smallest integer which never reaches a palindrome.
|
|
LINKS
|
|
|
EXAMPLE
|
19 -> 19 + 91 = 110 -> 110 + 011 = 121, so a(19) = 121.
|
|
MATHEMATICA
|
tol = 1000; r[n_] := FromDigits[Reverse[IntegerDigits[n]]]; palQ[n_] := n == r[n]; ar[n_] := n + r[n]; Table[k = 0; If[palQ[n], n = ar[n]; k = 1]; While[! palQ[n] && k < tol, n = ar[n]; k++]; If[k == tol, n = -1]; n, {n, 0, 64}] (* Jayanta Basu, Jul 11 2013 *)
Table[Module[{k=n+IntegerReverse[n]}, While[k!=IntegerReverse[k], k=k+IntegerReverse[k]]; k], {n, 0, 70}] (* The program uses the IntegerReverse function from Mathematica version 10 *) (* Harvey P. Dale, Jul 19 2016 *)
|
|
PROG
|
(ARIBAS): var st: stack; test: boolean; end; for k := 0 to 60 do n := k; test := true; while test do n := n + int_reverse(n); test := n <> int_reverse(n); end; stack_push(st, n); end; stack2array(st).
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|