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