The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A332058 a(1) = 1; a(n+1) = a(n) +- (sum of digits of a(1) up to a(n)), with "+" when a(n) is odd, or "-" if even. 2
 1, 2, -1, 3, 10, 2, -8, -26, -52, -85, -39, 19, 87, 170, 79, 186, 64, -68, -214, -367, -198, -385, -182, -396, -628, -876, -1145, -865, -566, -882, -1216, -1560, -1916, -2289, -1895, -1478, -1915, -1462, -1928, -2414, -2911, -2401 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,2 COMMENTS The graph appears to have a shape similar to that of Mertens function A002321, with increasingly large "mountains" and "valleys": Successive record values of opposite sign are a(2) = 2, a(3) = -1, a(5) = 10, a(10) = -85, a(16) = 186, a(222) = -75573, a(391) = 26186, a(658) = -341791, a(987) = 134304, a(1831) = -1820815, a(2476) = 393048, a(2692) = -2089141, a(3321) = 1816290, a(6114) = -8650189, ... LINKS M. F. Hasler, Table of n, a(n) for n = 1..10000 Eric Angelini, Re: Add or subtract my cumulative sum of digits, SeqFan list, Feb 24 2020. EXAMPLE a(1) = 1 is odd, so we add the partial sum (so far equal to a(1)) to get the next term, a(2) = 2. Now a(2) = 2 is even, so we subtract the sum of the digits of a(1) and a(2), 1 + 2 = 3 to get a(3) = -1. Since a(3) = -1 is odd, we add the sum of the digits of a(1), a(2) and a(3), 1 + 2 + 1 = 4 to get a(4) = 3. And so on. MATHEMATICA Nest[Append[#, #[[-1]] + (2 Boole[OddQ@ #[[-1]] ] - 1)*Total[Flatten@ IntegerDigits[#]] ] &, {1}, 41] (* Michael De Vlieger, Feb 25 2020 *) PROG (PARI) A332058_vec(N, a=1, s=-a)={vector(N, n, a-=(-1)^a*s+=sumdigits(a))} CROSSREFS See A332056 for the variant considering sum of a(n) instead of digits. Sequence in context: A246063 A332064 A229417 * A260758 A091858 A070165 Adjacent sequences:  A332055 A332056 A332057 * A332059 A332060 A332061 KEYWORD sign,base AUTHOR Eric Angelini and M. F. Hasler, Feb 24 2020 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified August 6 18:25 EDT 2020. Contains 336256 sequences. (Running on oeis4.)