OFFSET
1,2
COMMENTS
See A121758. In decimal number system, take odd digits of n with negative sign.
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
If n = d(i)*10^(i-1), then a(n) = (-1)^(1+d(i))*d(i)*10^(i-1).
a(n) = -A121758(n).
EXAMPLE
a(12) = 8 because 12 = 1*10^1 + 2*10^0 and a(12) = (-1)^(1+1)*1*10^1 + (-1)^(1+2)*2*10^0 = 10-2 = 8.
MATHEMATICA
a[n_] := Total[MapIndexed[(-1)^(#1 + 1)*#1*10^(#2[[1]] - 1)&, Reverse[ IntegerDigits[n]]]]; Array[a, 78] (* Jean-François Alcover, Jun 20 2017 *)
PROG
(Haskell)
import Data.List (unfoldr)
a121759 = foldl f 0 . reverse . unfoldr d where
d 0 = Nothing
d x = Just $ swap $ divMod x 10
f v d | even d = 10 * v - d
| odd d = 10 * v + d
-- Reinhard Zumkeller, Aug 01 2011
CROSSREFS
KEYWORD
AUTHOR
Zak Seidov, Aug 20 2006
STATUS
approved