OFFSET
1,2
COMMENTS
a(n) is odd iff 5 <= n mod 20 <= 14. - Saish S. Kambali, Aug 14 2023
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,0,0,0,0,0,2,-2,0,0,0,0,0,0,0,0,-1,1).
FORMULA
a(n) = sn(n,2) + sn(n,5) - sn(n,10) where sn(n,d) = (an(n,d) * (an(n,d) + d))/(2*d) and an(n,d) = d * floor(n/d).
a(n) = Sum_{k=2..n} {k if gcd(k,10) > 1}.
MATHEMATICA
Accumulate[Table[n * Boole[MemberQ[Mod[n, {2, 5}], 0]], {n, 0, 55}]] (* Amiram Eldar, Aug 09 2023 *)
PROG
(Python)
sn = lambda k, n: ((n // k)*((n // k) + 1) * k) // 2
a = lambda n: sn(2, n) + sn(5, n) - sn(10, n)
print([a(n) for n in range(1, 56)])
(PARI) a(n) = vecsum(select(x->(!(x%2) || !(x%5)), [1..n])); \\ Michel Marcus, Aug 09 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Darío Clavijo, Aug 09 2023
STATUS
approved