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.

A125688 Number of partitions of n into three distinct primes.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 2, 1, 2, 2, 2, 2, 2, 2, 3, 3, 2, 3, 2, 4, 3, 4, 2, 5, 3, 5, 4, 6, 1, 6, 3, 6, 4, 6, 3, 9, 3, 8, 5, 8, 4, 11, 3, 11, 5, 10, 3, 13, 3, 13, 6, 12, 2, 14, 5, 15, 6, 13, 2, 18, 5, 17, 6, 14, 4, 21, 5, 19, 7, 17, 4, 25, 4, 20, 8, 21, 4, 26, 4, 25, 9, 22, 4
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 30 2006

Keywords

Comments

a(A124868(n)) = 0; a(A124867(n)) > 0;
a(A125689(n)) = n and a(m) <> n for m < A125689(n).

Examples

			a(42) = #{2+3+37, 2+11+29, 2+17+23} = 3.
		

Crossrefs

Column k=3 of A219180. - Alois P. Heinz, Nov 13 2012

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, [1,0$3], `if`(i<1, [0$4],
           zip((x, y)->x+y, b(n, i-1), [0, `if`(ithprime(i)>n, [0$3],
           b(n-ithprime(i), i-1)[1..3])[]], 0)))
        end:
    a:= n-> b(n, numtheory[pi](n))[4]:
    seq(a(n), n=1..100);  # Alois P. Heinz, Nov 15 2012
  • Mathematica
    b[n_, i_] := b[n, i] = If[n == 0, {1, 0, 0, 0}, If[i<1, {0, 0, 0, 0}, Plus @@ PadRight[{b[n, i-1], Join[{0}, If[Prime[i]>n, {0, 0, 0}, Take[b[n-Prime[i], i-1], 3]]]}]]]; a[n_] := b[n, PrimePi[n]][[4]]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jan 30 2014, after Alois P. Heinz *)
    dp3Q[{a_,b_,c_}]:=Length[Union[{a,b,c}]]==3&&AllTrue[{a,b,c},PrimeQ]; Table[ Count[IntegerPartitions[n,{3}],?dp3Q],{n,100}] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale, Jan 30 2019 *)
  • PARI
    a(n)=my(s);forprime(p=n\3,n-4,forprime(q=(n-p)\2+1,min(n-p,p-1),if(isprime(n-p-q),s++)));s \\ Charles R Greathouse IV, Aug 27 2012

Formula

From Alois P. Heinz, Nov 22 2012: (Start)
G.f.: Sum_{0
a(n) = [x^n*y^3] Product_{i>=1} (1+x^prime(i)*y). (End)
a(n) = Sum_{k=1..floor((n-1)/3)} Sum_{i=k+1..floor((n-k-1)/2)} A010051(i) * A010051(k) * A010051(n-i-k). - Wesley Ivan Hurt, Mar 29 2019