cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A364834 Sum of positive integers <= n which are multiples of 2 or 5.

Original entry on oeis.org

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

Views

Author

DarĂ­o Clavijo, Aug 09 2023

Keywords

Comments

a(n) is odd iff 5 <= n mod 20 <= 14. - Saish S. Kambali, Aug 14 2023

Crossrefs

Programs

  • Mathematica
    Accumulate[Table[n * Boole[MemberQ[Mod[n, {2, 5}], 0]], {n, 0, 55}]] (* Amiram Eldar, Aug 09 2023 *)
  • PARI
    a(n) = vecsum(select(x->(!(x%2) || !(x%5)), [1..n])); \\ Michel Marcus, Aug 09 2023
  • 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)])
    

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