OFFSET
1,3
COMMENTS
a(2) = -1 is the only negative term of the sequence.
LINKS
Vaclav Kotesovec, Table of n, a(n) for n = 1..10000
FORMULA
a(n) ~ (Pi^2*n^2*log(n/4))/(24*log(n/2)*log(n)) as n -> infinity.
EXAMPLE
a(4) = 0 since the greatest prime factors of {1,2,3,4} are {1,2,3,2} and the alternating sum 1-2+3-2 = 0.
MATHEMATICA
a[k_] := Sum[(-1)^(n + 1)*ResourceFunction["LargestPrimeFactor"][n], {n, 1, k}]; Table[a[n], {n, 1, 64}]
(* Alternative: *)
Accumulate[Table[(-1)^(n + 1)*FactorInteger[n][[-1, 1]], {n, 1, 100}]] (* Vaclav Kotesovec, Aug 09 2025 *)
PROG
(PARI) a(n)=if(n>1, vecmax(factor(n)[, 1]), 1); s(k)=sum(n=1, k, a(n)*(-1)^(n+1))
CROSSREFS
KEYWORD
sign,changed
AUTHOR
Luca Onnis, Feb 11 2023
STATUS
approved
