OFFSET
1,6
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
EXAMPLE
a(5) = -(5 mod 1)+(4 mod 2)-(3 mod 3)+(2 mod 4)-(1 mod 5) = -0+0-0+2-1 = 1.
MAPLE
P:=proc(i) local a, n; for n from 1 by 1 to i do a:=abs(sum('(-1)^k*((n-k+1) mod k)', 'k'=1..n)); print(a); od; end: P(100);
MATHEMATICA
a[n_] := Abs @ Sum[(-1)^k * Mod[n - k + 1, k], {k, 1, n}]; Array[a, 100] (* Amiram Eldar, Sep 18 2021 *)
PROG
(PARI) a(n) = abs(sum(k=1, n, (-1)^k * lift(Mod(n-k+1, k)))); \\ Michel Marcus, Sep 18 2021
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Paolo P. Lava and Giorgio Balzarotti, Jan 12 2009
STATUS
approved