A304439 Add to n the sum of its odd digits minus the sum of its even digits.
0, 2, 0, 6, 0, 10, 0, 14, 0, 18, 11, 13, 11, 17, 11, 21, 11, 25, 11, 29, 18, 20, 18, 24, 18, 28, 18, 32, 18, 36, 33, 35, 33, 39, 33, 43, 33, 47, 33, 51, 36, 38, 36, 42, 36, 46, 36, 50, 36, 54, 55, 57, 55, 61, 55, 65, 55, 69, 55, 73, 54, 56, 54, 60, 54, 64, 54, 68, 54, 72
Offset: 0
Programs
-
Mathematica
soded[n_]:=Module[{idn=IntegerDigits[n]},n+Total[Select[idn,OddQ]]-Total[ Select[idn,EvenQ]]]; Array[soded,70,0] (* Harvey P. Dale, Aug 12 2021 *)
-
PARI
A304439(n)=n-vecsum(apply(t->t*(-1)^t,digits(n)))
Formula
a(n) = n + A071650(n).
Comments