login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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
OFFSET
1,3
COMMENTS
a(n) = A178403(n) for n < 48. [Reinhard Zumkeller, May 27 2010]
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:
select(filter, [$0..1000]); # Robert Israel, Aug 26 2014
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)
} \\ David A. Corneth, Dec 01 2023
CROSSREFS
Sequence in context: A376425 A178403 A134336 * A355617 A032981 A136332
KEYWORD
nonn,base
AUTHOR
Rachit Agrawal (rachit_agrawal(AT)daiict.ac.in), Oct 23 2007
EXTENSIONS
Corrected by Harvey P. Dale, Aug 22 2014
STATUS
approved