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.

A284203 Number of twin prime (A001097) divisors of n.

Original entry on oeis.org

0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 1, 0, 1, 1, 1, 1, 1, 1, 2, 1, 0, 2, 1, 2, 1, 0, 1, 2, 1, 1, 2, 1, 1, 2, 0, 0, 1, 1, 1, 2, 1, 0, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 0, 2, 2, 0, 1, 1, 2, 1, 1, 1, 0, 2, 1, 2, 2, 0, 1, 1, 1, 0, 2, 2, 1, 2, 1, 0, 2, 2, 0, 2, 0, 2, 1, 0, 1, 2, 1, 1, 2, 1, 1, 3, 0, 1, 1, 1, 2
Offset: 1

Views

Author

Ilya Gutkovskiy, Mar 22 2017

Keywords

Examples

			--------------------------------------------
| n | divisors of n | twin prime    | a(n) |
|   |               | divisors of n |      |
|------------------------------------------
| 1 | {1}           |      {-}      |  0   |
| 2 | {1, 2}        |      {-}      |  0   |
| 3 | {1, 3}        |      {3}      |  1   |
| 4 | {1, 2, 4}     |      {-}      |  0   |
| 5 | {1, 5}        |      {5}      |  1   |
| 6 | {1, 2, 3, 6}  |      {3}      |  1   |
| 7 | {1, 7}        |      {7}      |  1   |
| 8 | {1, 2, 4, 8}  |      {-}      |  0   |
| 9 | {1, 3, 9}     |      {3}      |  1   |
--------------------------------------------
		

Crossrefs

Cf. A048599 (positions of records).

Programs

  • Mathematica
    nmax = 110; Rest[CoefficientList[Series[Sum[Boole[PrimeQ[k] && (PrimeQ[k - 2] || PrimeQ[k + 2])] x^k/(1 - x^k), {k, 1, nmax}], {x, 0, nmax}], x]]
    Table[Length[Select[Divisors[n], PrimeQ[#] && (PrimeQ[# - 2] || PrimeQ[# + 2]) &]], {n, 110}]
  • PARI
    concat([0, 0],Vec(sum(k=1, 110, (isprime(k) && (isprime(k - 2) || isprime(k + 2)))* x^k/(1 - x^k)) + O(x^111))) \\ Indranil Ghosh, Mar 22 2017
    
  • PARI
    a(n) = sumdiv(n, d, isprime(d) && (isprime(d-2) || isprime(d+2))); \\ Amiram Eldar, Jun 03 2024
    
  • Python
    from sympy import isprime, divisors
    print([len([i for i in divisors(n) if isprime(i) and (isprime(i - 2) or isprime(i + 2))]) for n in range(1, 111)]) # Indranil Ghosh, Mar 22 2017

Formula

G.f.: Sum_{k>=1} x^A001097(k)/(1 - x^A001097(k)).
a(A062729(n)) = 0. - Ilya Gutkovskiy, Apr 02 2017
From Amiram Eldar, Jun 03 2024: (Start)
a(A048599(n)) = n.
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = A065421 - 1/5 = 1.7021605... . (End)
Additive with a(p^e) = 1 if p is in A001097, and 0 otherwise. - Amiram Eldar, May 15 2025
a(A037074(n)) = 2. - Michel Marcus, May 15 2025