login
a(n) = n - (reversal of digits of n).
26

%I #40 Dec 20 2023 09:48:28

%S 0,0,0,0,0,0,0,0,0,0,9,0,-9,-18,-27,-36,-45,-54,-63,-72,18,9,0,-9,-18,

%T -27,-36,-45,-54,-63,27,18,9,0,-9,-18,-27,-36,-45,-54,36,27,18,9,0,-9,

%U -18,-27,-36,-45,45,36,27,18,9,0,-9,-18,-27,-36,54,45,36,27,18,9,0,-9,-18,-27,63,54,45,36,27,18,9,0,-9,-18,72,63,54

%N a(n) = n - (reversal of digits of n).

%C a(n) is a multiple of 9.

%H Reinhard Zumkeller, <a href="/A056965/b056965.txt">Table of n, a(n) for n = 0..10000</a>

%H <a href="/index/K#Kaprekar_map">Index entries for the Kaprekar map</a>

%F a(n) = n - A004086(n) = 2*n - A056964(n).

%e a(17) = 17 - 71 = -54.

%p a:= n-> (s-> n-parse(cat(s[-i]$i=1..length(s))))(""||n):

%p seq(a(n), n=0..82); # _Alois P. Heinz_, Jul 11 2021

%t Table[n - FromDigits[Reverse[IntegerDigits[n]]], {n, 0, 82}] (* _Jayanta Basu_, Jul 11 2013 *)

%o (Haskell)

%o a056965 n = n - a004086 n -- _Reinhard Zumkeller_, Sep 17 2013

%o (Python)

%o def a(n): return n - int(str(n)[::-1]) # _Osman Mustafa Quddusi_, Jul 11 2021

%o (PARI) a(n) = n - fromdigits(Vecrev(digits(n))); \\ _Michel Marcus_, Dec 20 2023

%Y Cf. A004086, A056964, A068396, A151949, A265326.

%K base,sign,look

%O 0,11

%A _Henry Bottomley_, Jul 18 2000