login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

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

%I #26 Mar 14 2023 10:06:10

%S 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,

%T 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,

%U 4,3,4,3,4,3,2,3,2,3,4,3,2,3,4,3

%N 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.

%C 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

%F For n >= 2, if A006530(n) > A006530(n-1), then a(n) = a(n-1) + 1; a(n) = a(n-1) - 1 otherwise.

%F a(n) = (-1)*Sum_{i=1..n-1} (-1)^A087429(i).

%F a(1 + A070089(n)) = 1 + a(A070089(n)). - _Thomas Scheuerle_, Jan 20 2023

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

%t Join[{0}, Accumulate@ Sign@ Differences@ Table[FactorInteger[n][[-1, 1]], {n, 1, 100}]] (* _Amiram Eldar_, Jan 20 2023, after the MATLAB code *)

%o (MATLAB)

%o function a = A359953(max_n)

%o a = [0 cumsum(sign(diff([0 arrayfun(@(x)(max(factor(x))),[2:max_n])])))];

%o end % _Thomas Scheuerle_, Jan 20 2023

%o (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

%Y Cf. A000040, A006530, A070089, A087429.

%K easy,sign

%O 1,3

%A _Tamas Sandor Nagy_, Jan 19 2023