login
A364834
Sum of positive integers <= n which are multiples of 2 or 5.
0
0, 2, 2, 6, 11, 17, 17, 25, 25, 35, 35, 47, 47, 61, 76, 92, 92, 110, 110, 130, 130, 152, 152, 176, 201, 227, 227, 255, 255, 285, 285, 317, 317, 351, 386, 422, 422, 460, 460, 500, 500, 542, 542, 586, 631, 677, 677, 725, 725, 775, 775, 827, 827, 881, 936
OFFSET
1,2
COMMENTS
a(n) is odd iff 5 <= n mod 20 <= 14. - Saish S. Kambali, Aug 14 2023
LINKS
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
Sequence in context: A308260 A279212 A299018 * A269830 A350114 A275312
KEYWORD
nonn,easy
AUTHOR
Darío Clavijo, Aug 09 2023
STATUS
approved