login
A338108
Numbers that follow from the alternating series a(n) = d(1) - d(2) + d(3) - d(4) + ... + (-1)^(n+1) d(n), where d(k) denotes the k-th term of the digit sequence of Euler's number e.
2
2, -5, -4, -12, -10, -18, -17, -25, -23, -31, -27, -32, -23, -23, -19, -24, -22, -25, -20, -23, -17, -17, -15, -23, -16, -20, -13, -14, -11, -16, -14, -20, -14, -16, -12, -21, -14, -21, -16, -23, -21, -25, -18, -18, -9, -12, -6, -15, -6, -15, -10, -19, -14, -21
OFFSET
1,1
LINKS
FORMULA
a(1) = d(1) = 2; a(n) = a(n-1) + (-1)^(n+1) d(n) for n > 1.
EXAMPLE
a(3) = d(1) - d(2) + d(3) = 2 - 7 + 1 = -4.
MATHEMATICA
S[X_, n_] :=
Module[{f},
f[1] = First[RealDigits[ X, 10, 1]][[1]];
f[i_] :=
f[i] = (-1)^(i + 1) First[RealDigits[ X, 10, i]][[i]] + f[i - 1];
Table[f[m], {m, 1, n}]
]
S[E, 20] (* Generates the first 20 elements of the series *)
Accumulate[Times@@@Partition[Riffle[RealDigits[E, 10, 100][[1]], {1, -1}], 2]] (* Harvey P. Dale, May 08 2021 *)
CROSSREFS
Cf. A001113 (e), A069159 (similar for Pi).
Sequence in context: A094471 A362418 A329372 * A291650 A285292 A346595
KEYWORD
base,easy,sign
AUTHOR
Dirk Broeders, Oct 10 2020
STATUS
approved