|
|
A131207
|
|
Nonnegative integers n such that the difference between n and its reverse is a palindrome.
|
|
2
|
|
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 21, 22, 23, 32, 33, 34, 43, 44, 45, 54, 55, 56, 65, 66, 67, 76, 77, 78, 87, 88, 89, 98, 99, 100, 101, 102, 110, 111, 112, 120, 121, 122, 130, 131, 132, 140, 141, 142, 150, 151, 152, 160, 161, 162, 170, 171, 172, 180
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
|
|
LINKS
|
|
|
EXAMPLE
|
122 is in the sequence as the difference between 122 and its reversal (211) is 99 which is a palindrome. - David A. Corneth, Dec 01 2023
|
|
MAPLE
|
filter:= proc(n) local L, nL, r;
L:= convert(n, base, 10);
nL:= nops(L);
r:= add(L[i]*10^(nL-i), i=1..nL);
L:= convert(abs(n-r), base, 10);
evalb(L = ListTools:-Reverse(L))
end proc:
|
|
MATHEMATICA
|
revpalQ[n_]:=Module[{diff=IntegerDigits[Abs[n-FromDigits[Reverse[ IntegerDigits[ n]]]]]}, diff==Reverse[diff]]; Select[Range[ 0, 400], revpalQ] (* Harvey P. Dale, Aug 22 2014 *)
|
|
PROG
|
(Java) for(i = 1; i <=1000; i++){ n = Math.abs(i - reverseNumber(i)); if(n == reverseNumber(n)){ System.out.println(i); } }
(PARI)
is(n) = {
my(d = abs(fromdigits(Vecrev(digits(n))) - n));
d = digits(d);
d == Vecrev(d)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
Rachit Agrawal (rachit_agrawal(AT)daiict.ac.in), Oct 23 2007
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|