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.

A359953 a(1) = 0, a(2) = 1. For n >= 3, if the greatest prime dividing n is greater than the greatest prime dividing n-1, then a(n) = a(n-1) + 1. Otherwise a(n) = a(n-1) - 1.

Original entry on oeis.org

0, 1, 2, 1, 2, 1, 2, 1, 2, 3, 4, 3, 4, 3, 2, 1, 2, 1, 2, 1, 2, 3, 4, 3, 4, 5, 4, 5, 6, 5, 6, 5, 6, 7, 6, 5, 6, 5, 4, 3, 4, 3, 4, 3, 2, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 6, 5, 6, 5, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 2, 3, 2, 3, 4, 3, 2, 3, 4, 3
Offset: 1

Views

Author

Tamas Sandor Nagy, Jan 19 2023

Keywords

Comments

The first negative value is at a(3888). Within the first 1000000 values are the negative record values a(n) = -4 at n = {3913, 3915, 3927, 3933}. - Thomas Scheuerle, Jan 20 2023

Examples

			a(5) = a(4) + 1 = 1 + 1 = 2 because A006530(5) = 5 > A006530(4) = 2.
		

Crossrefs

Programs

  • MATLAB
    function a = A359953(max_n)
        a = [0 cumsum(sign(diff([0 arrayfun(@(x)(max(factor(x))),[2:max_n])])))];
    end % Thomas Scheuerle, Jan 20 2023
    
  • Mathematica
    Join[{0}, Accumulate@ Sign@ Differences@ Table[FactorInteger[n][[-1, 1]], {n, 1, 100}]] (* Amiram Eldar, Jan 20 2023, after the MATLAB code *)
  • PARI
    lista(nn) = my(va = vector(nn)); va[1] = 0; va[2] = 1; for (n=3, nn, if (vecmax(factor(n)[,1]) > vecmax(factor(n-1)[,1]), va[n] = va[n-1] + 1, va[n] = va[n-1] - 1);); va; \\ Michel Marcus, Jan 31 2023

Formula

For n >= 2, if A006530(n) > A006530(n-1), then a(n) = a(n-1) + 1; a(n) = a(n-1) - 1 otherwise.
a(n) = (-1)*Sum_{i=1..n-1} (-1)^A087429(i).
a(1 + A070089(n)) = 1 + a(A070089(n)). - Thomas Scheuerle, Jan 20 2023