login
A390009
Numbers k such that the sum of the digits of k equals the sum of the digits of |k - reverse(k)|.
1
0, 18, 27, 36, 45, 54, 63, 72, 81, 90, 189, 198, 279, 288, 297, 369, 378, 387, 396, 459, 468, 477, 486, 495, 549, 558, 567, 576, 594, 639, 648, 657, 675, 684, 693, 729, 738, 756, 765, 774, 783, 792, 819, 837, 846, 855, 864, 873, 882, 891, 918, 927, 936, 945, 954, 963, 972, 981, 990
OFFSET
1,2
COMMENTS
The digit sum of these numbers equals the digit sum of their absolute difference with their reversal.
All terms have sum of digits divisible by 9 (see A056965). - Michael S. Branicky, Oct 21 2025
LINKS
FORMULA
{k | A007953(k) = A007953(abs(k - A004086(k))) = A007953(abs(A056965(k)))}.
EXAMPLE
18 is included because reverse(18) = 81, |18 - 81| = 63, and both have digit sum 9.
MATHEMATICA
Select[Range[0, 1300], DigitSum[#] == DigitSum[Abs[# - IntegerReverse[#]]] &] (* Amiram Eldar, Oct 21 2025 *)
PROG
(MATLAB)
seq = [];
for n = 0:2000
rev_n = str2num(fliplr(num2str(n)));
if sum(num2str(n)-'0') == sum(num2str(abs(n-rev_n))-'0')
seq = [seq, n];
end
end
seq
(Python)
def sd(s): return sum(map(int, s))
def ok(n): return sd(s:=str(n)) == sd(str(abs(n-int(s[::-1]))))
print([k for k in range(1252) if ok(k)]) # Michael S. Branicky, Oct 21 2025
(PARI) isok(k) = sumdigits(k) == sumdigits(abs(k-fromdigits(Vecrev(digits(k))))); \\ Michel Marcus, Oct 22 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Safwan Jaradat, Oct 21 2025
STATUS
approved