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.

A238403 Number of ways a number can be decomposed as a sum of the form pq + qr + rp where p < q < r are distinct primes.

Original entry on oeis.org

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

Views

Author

Jean-François Alcover, Feb 26 2014

Keywords

Comments

The average value of a(n) is >> sqrt(n)/log^3 n. - Charles R Greathouse IV, Feb 26 2014

Examples

			71 = 3*5 + 5*7 + 7*3 = 2*3 + 3*13 + 13*2, therefore a(71) = 2.
		

Crossrefs

Programs

  • Mathematica
    r[n_, p_] := Reduce[p < q < r && p*q+q*r+r*p == n, {q, r}, Primes]; a[n_] := (For[cnt = 0; p = 2, p <= Ceiling[(n-6)/5], p = NextPrime[p], rnp = r[n, p]; If[rnp =!= False, Which[rnp[[0]] === And, Print["n = ", n, " ", {p, q, r} /. ToRules[rnp]]; cnt++, rnp[[0]] === Or, Print["n = ", n, " ", {p, q, r} /. {ToRules[rnp]}]; cnt += Length[rnp], True, Print["error: n = ", n, " ", rnp]]]]; cnt); Table[a[n], {n, 1, 100}]
  • PARI
    list(n)=my(v=vector(n)); forprime(r=5,(n-6)\5, forprime(q=3, min((n-2*r)\(r+2),r-2), my(S=q+r,P=q*r); forprime(p=2,min((n-P)\S,q-1), v[p*S+P]++))); v \\ Charles R Greathouse IV, Feb 26 2014
    
  • PARI
    a(n)=my(s);forprime(r=(sqrtint(3*n-3)+5)\3,(n-6)\5, forprime(q= sqrtint(r^2+n)-r+1,min((n-2*r)\(r+2),r-2),if((n-q*r)%(q+r)==0 && isprime((n-q*r)/(q+r)),s++)));s \\ Charles R Greathouse IV, Feb 26 2014