login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A131207 Nonnegative integers n such that the difference between n and its reverse is a palindrome. 2

%I #23 Dec 01 2023 06:14:17

%S 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,

%T 66,67,76,77,78,87,88,89,98,99,100,101,102,110,111,112,120,121,122,

%U 130,131,132,140,141,142,150,151,152,160,161,162,170,171,172,180

%N Nonnegative integers n such that the difference between n and its reverse is a palindrome.

%C a(n) = A178403(n) for n < 48. [_Reinhard Zumkeller_, May 27 2010]

%H David A. Corneth, <a href="/A131207/b131207.txt">Table of n, a(n) for n = 1..10000</a>

%e 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

%p filter:= proc(n) local L,nL,r;

%p L:= convert(n,base,10);

%p nL:= nops(L);

%p r:= add(L[i]*10^(nL-i),i=1..nL);

%p L:= convert(abs(n-r),base,10);

%p evalb(L = ListTools:-Reverse(L))

%p end proc:

%p select(filter, [$0..1000]); # _Robert Israel_, Aug 26 2014

%t 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 *)

%o (Java) for(i = 1; i <=1000; i++){ n = Math.abs(i - reverseNumber(i)); if(n == reverseNumber(n)){ System.out.println(i); } }

%o (PARI)

%o is(n) = {

%o my(d = abs(fromdigits(Vecrev(digits(n))) - n));

%o d = digits(d);

%o d == Vecrev(d)

%o } \\ _David A. Corneth_, Dec 01 2023

%Y Cf. A002113, A178403.

%K nonn,base

%O 1,3

%A Rachit Agrawal (rachit_agrawal(AT)daiict.ac.in), Oct 23 2007

%E Corrected by _Harvey P. Dale_, Aug 22 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 09:38 EDT 2024. Contains 371967 sequences. (Running on oeis4.)