cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A332057 Partial sums (and absolute value of first differences) of A332056: if odd (resp. even) add (resp. subtract) the partial sum to get the next term.

Original entry on oeis.org

1, 3, 2, 3, 7, 4, 5, 11, 6, 7, 15, 8, 9, 19, 10, 11, 23, 12, 13, 27, 14, 15, 31, 16, 17, 35, 18, 19, 39, 20, 21, 43, 22, 23, 47, 24, 25, 51, 26, 27, 55, 28, 29, 59, 30, 31, 63, 32, 33, 67, 34, 35, 71, 36, 37, 75, 38, 39, 79, 40
Offset: 1

Views

Author

Eric Angelini and M. F. Hasler, Feb 24 2020

Keywords

Comments

The terms show a 3-quasiperiodic pattern (2m-1, 4m-1, 2m), m = 1, 2, 3, ...
Or: group positive integers by pairs, then insert the sum of the pair between the two terms.

Crossrefs

Cf. A332056.

Programs

  • PARI
    apply( {A332057(n)=n<
    				
  • PARI
    Vec(x*(1 + x)*(1 + 2*x + x^3) / ((1 - x)^2*(1 + x + x^2)^2) + O(x^60)) \\ Colin Barker, Feb 26 2020

Formula

a(3k-2) = 2k - 1, a(3k-1) = 4k - 1, a(3k) = 2k, for all k >= 1.
From Colin Barker, Feb 25 2020: (Start)
G.f.: x*(1 + x)*(1 + 2*x + x^3) / ((1 - x)^2*(1 + x + x^2)^2).
a(n) = 2*a(n-3) - a(n-6) for n>6.
(End)

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.

Original entry on oeis.org

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
Offset: 1

Views

Author

Eric Angelini and M. F. Hasler, Feb 24 2020

Keywords

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, ...

Examples

			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.
		

Crossrefs

See A332056 for the variant considering sum of a(n) instead of digits.

Programs

  • Mathematica
    Nest[Append[#, #[[-1]] + (2 Boole[OddQ@ #[[-1]] ] - 1)*Total[Flatten@ IntegerDigits[#]] ] &, {1}, 41] (* Michael De Vlieger, Feb 25 2020 *)
  • PARI
    A332058_vec(N,a=1,s=-a)={vector(N,n, a-=(-1)^a*s+=sumdigits(a))}
    
  • Python
    from itertools import count, islice
    def agen(): # generator of terms
        an, s = 1, 1
        while True:
            yield an
            an = an + s if an&1 else an - s
            s += sum(map(int, str(abs(an))))
    print(list(islice(agen(), 42))) # Michael S. Branicky, Oct 14 2024

A332059 Absolute value of first differences, or sum of digits of the first n terms of A332058.

Original entry on oeis.org

1, 3, 4, 7, 8, 10, 18, 26, 33, 46, 58, 68, 83, 91, 107, 122, 132, 146, 153, 169, 187, 203, 214, 232, 248, 269, 280, 299, 316, 334, 344, 356, 373, 394, 417, 437, 453, 466, 486, 497, 510, 517, 538, 548, 566, 583, 598, 609, 623
Offset: 1

Views

Author

Eric Angelini and M. F. Hasler, Feb 25 2020

Keywords

Crossrefs

See A332057 for the variant corresponding to A332056 instead of A332058.

Programs

Showing 1-3 of 3 results.