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.

A230595 Number of ways to write n as n = x*y, where x and y are primes, 1 <= x <= n, 1 <= y <= n.

Original entry on oeis.org

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

Views

Author

Jaroslav Krizek, Oct 27 2013

Keywords

Comments

Dirichlet convolution of A010051(n) with itself, where A010051 = characteristic function of primes (A000040).
Dirichlet convolution of functions b(n) and c(n) is function a(n) = Sum_(d|n) b(d) * c(n/d).
a(n) = 0, 1 or 2. a(n) = 0 for numbers n from A100959 (non-semiprimes); a(n) = 1 for n = p^2, p = prime; a(n) = 2 for numbers n from A006881 (product of two distinct primes).

Examples

			For n = 6: a(6) = Sum_(d|6) A010051(d) * A010051(6/d) = 0*0 + 1*1 + 1*1 + 1*0 = 2.
		

Crossrefs

Programs

  • Mathematica
    Table[Total@ Map[Times @@ Boole@ {PrimeQ@ #, PrimeQ[n/#]} &, FactorInteger[n][[All, 1]]], {n, 95}] (* Michael De Vlieger, Jul 29 2017 *)
  • PARI
    a(n)=sumdiv(n,d,isprime(d)*isprime(n/d)) \\ Ralf Stephan, Oct 30 2013
    
  • PARI
    a(n) = my(f=factor(f)); (vecsum(f[, 2])==2) * #f~ \\ David A. Corneth, Jul 28 2017
    
  • PARI
    first(n) = my(v = vector(n)); forprime(p = 2, sqrtint(n), v[p^2] = 1; forprime(q = p + 1, n \ p, v[p*q] = 2)); v \\ David A. Corneth, Jul 28 2017
    
  • Python
    from sympy import factorint
    def A230595(n): return 0 if sum(f:=factorint(n).values())!=2 else len(f) # Chai Wah Wu, Jul 23 2024

Formula

a(n) = Sum_(d|n) A010051(d) * A010051(n/d).
Dirichlet g.f.: primezeta(s)^2. - Benedict W. J. Irwin, Jul 11 2018