login
Numbers n such that if you subtract n-reversed from n you get a natural number with the same digits as n.
3

%I #10 Sep 04 2015 11:27:39

%S 954,1980,2961,3870,5823,7641,9108,19980,29880,29961,32760,38970,

%T 39780,49680,49842,54270,58923,59580,60273,60732,69462,69480,69723,

%U 70254,73260,76941,79344,79380,89226,89280,89604,90810,91908,96732,99108

%N Numbers n such that if you subtract n-reversed from n you get a natural number with the same digits as n.

%D David Wells, The Penguin Dictionary of Curious and Interesting Numbers (Rev. ed. 1997), p. 154 (entry for 1980).

%H Harvey P. Dale, <a href="/A121969/b121969.txt">Table of n, a(n) for n = 1..1000</a>

%e 954 - 459 = 495, 19980 - 8991 = 10989.

%t srdQ[n_]:=Module[{idn=IntegerDigits[n],rn},rn=FromDigits[Reverse[idn]];n>rn&&Sort[IntegerDigits[n-rn]]==Sort[idn]]; Select[Range[100000], srdQ] (* _Harvey P. Dale_, Jun 21 2013 *)

%o (PARI) isok(n) = {my(d = digits(n)); diff = my(n - subst(Polrev(d), x, 10)); (diff > 0) && (vecsort(digits(diff)) == vecsort(d));} \\ _Michel Marcus_, Sep 04 2015

%Y Cf. A055161.

%K base,nonn

%O 1,1

%A _Tanya Khovanova_, Sep 04 2006