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.

A178144 Sum of divisors d of n which are d=2, 3 or 5.

Original entry on oeis.org

0, 2, 3, 2, 5, 5, 0, 2, 3, 7, 0, 5, 0, 2, 8, 2, 0, 5, 0, 7, 3, 2, 0, 5, 5, 2, 3, 2, 0, 10, 0, 2, 3, 2, 5, 5, 0, 2, 3, 7, 0, 5, 0, 2, 8, 2, 0, 5, 0, 7, 3, 2, 0, 5, 5, 2, 3, 2, 0, 10, 0, 2, 3, 2, 5, 5, 0, 2, 3, 7, 0, 5, 0, 2, 8, 2, 0, 5, 0, 7, 3, 2, 0, 5, 5, 2, 3, 2, 0, 10, 0, 2, 3, 2, 5, 5, 0, 2, 3, 7, 0, 5, 0, 2, 8
Offset: 1

Views

Author

Vladimir Shevelev, May 21 2010

Keywords

Comments

The sequence is periodic with period length 30.

Crossrefs

Programs

  • Maple
    A178144 := proc(n)
        local a;
        a := 0 ;
        for d in {2,3,5} do
            if (n mod d) = 0 then
                a := a+d ;
            end if;
        end do:
        a ;
    end proc: # R. J. Mathar, Jul 23 2012
  • Mathematica
    a[n_] := DivisorSum[n, Boole[MatchQ[#, 2|3|5]]*#&];
    Array[a, 105] (* Jean-François Alcover, Nov 24 2017 *)
    a[n_] := Sum[d * Boole[Divisible[n, d]], {d, {2, 3, 5}}]; Array[a, 100] (* Amiram Eldar, Dec 20 2024 *)
  • PARI
    a(n) = sumdiv(n, d, if ((d==2) || (d==3) || (d==5), d)); \\ Michel Marcus, Nov 24 2017
    
  • PARI
    a(n) = my(d = [2, 3, 5]); sum(k = 1, 3, d[k] * !(n % d[k])); \\ Amiram Eldar, Dec 20 2024

Formula

From R. J. Mathar, Jul 23 2012: (Start)
a(n) = -2*a(n-1) -2*a(n-2) -a(n-3) +a(n-5) +2*a(n-6) +2*a(n-7) +a(n-8).
G.f.: ( -x*(2+7*x+12*x^2+17*x^3+22*x^4+10*x^6+20*x^5) ) / ( (x-1)*(1+x)*(1+x+x^2)*(x^4+x^3+x^2+x+1) ). (End)