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.

A284599 Sum of twin prime (A001097) divisors of n.

Original entry on oeis.org

0, 0, 3, 0, 5, 3, 7, 0, 3, 5, 11, 3, 13, 7, 8, 0, 17, 3, 19, 5, 10, 11, 0, 3, 5, 13, 3, 7, 29, 8, 31, 0, 14, 17, 12, 3, 0, 19, 16, 5, 41, 10, 43, 11, 8, 0, 0, 3, 7, 5, 20, 13, 0, 3, 16, 7, 22, 29, 59, 8, 61, 31, 10, 0, 18, 14, 0, 17, 3, 12, 71, 3, 73, 0, 8, 19, 18, 16, 0, 5, 3, 41, 0, 10, 22, 43, 32, 11, 0, 8
Offset: 1

Views

Author

Ilya Gutkovskiy, Mar 30 2017

Keywords

Examples

			a(15) = 8 because 15 has 4 divisors {1, 3, 5, 15} among which 2 are twin primes {3, 5} therefore 3 + 5 = 8.
		

Crossrefs

Programs

  • Maple
    N:= 200: # to get a(1)..a(N)
    P:= select(isprime, {seq(i,i=3..N+2)}):
    TP:= P intersect map(`-`,P,2):
    TP:= TP union map(`+`,TP,2):
    V:= Vector(N):
    for p in TP do
      pm:= [seq(i,i=p..N,p)];
      V[pm]:= map(`+`,V[pm],p);
    od:
    convert(V,list); # Robert Israel, Mar 30 2017
  • Mathematica
    Table[Total[Select[Divisors[n], PrimeQ[#1] && (PrimeQ[#1 - 2] || PrimeQ[#1 + 2]) &]], {n, 80}]
  • PARI
    a(n) = sumdiv(n, d, d*(isprime(d) && (isprime(d-2) || isprime(d+2)))); \\ Michel Marcus, Apr 02 2017
  • Python
    from sympy import divisors, isprime
    def a(n): return sum([i for i in divisors(n) if isprime(i) and (isprime(i - 2) or isprime(i + 2))])
    print([a(n) for n in range(1, 91)]) # Indranil Ghosh, Mar 30 2017
    

Formula

G.f.: Sum_{k>=1} A001097(k)*x^A001097(k)/(1 - x^A001097(k)).
a(n) = Sum_{d|n, d twin prime} d.
a(A062729(n)) = 0.
a(A001097(n)) = A001097(n).
Additive with a(p^e) = p if p is in A001097, and 0 otherwise. - Amiram Eldar, May 15 2025