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.

A219181 Number of partitions of n into the maximal possible number of distinct prime parts or 0 if there are no such partitions.

Original entry on oeis.org

1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 2, 1, 3, 1, 3, 2, 4, 2, 4, 2, 5, 2, 1, 4, 1, 4, 1, 4, 1, 6, 2, 6, 1, 6, 2, 8, 4, 10, 2, 1, 5, 1, 6, 1, 5, 2, 6, 2, 10, 1, 9, 1, 11, 4, 15, 3, 14, 3, 1, 6, 1, 6, 1, 5, 1, 10, 1, 11
Offset: 0

Views

Author

Alois P. Heinz, Nov 13 2012

Keywords

Comments

a(n) is the last element of row n of triangle A219180 or 0 if the row is empty. a(n) = 0 iff n in {1,4,6}.

Examples

			a(18) = 2 because there are 2 partitions of 18 into 3 distinct prime parts ([2,3,13], [2,5,11]) but no partitions of 18 into more than 3 distinct prime parts.
		

Programs

  • Maple
    with(numtheory):
    b:= proc(n, i) option remember;
          `if`(n=0, [1], `if`(i<1, [], zip((x, y)->x+y, b(n, i-1),
           [0, `if`(ithprime(i)>n, [], b(n-ithprime(i), i-1))[]], 0)))
        end:
    a:= proc(n) local l; l:=b(n,pi(n));
           while nops(l)>0 and l[-1]=0 do
              l:= subsop(-1=NULL, l)
           od;
           `if`(nops(l)=0, 0, l[-1])
        end:
    seq(a(n), n=0..100);
  • Mathematica
    zip = With[{m = Max[Length[#1], Length[#2]]}, PadRight[#1, m] + PadRight[#2, m]]&; b[n_, i_] := b[n, i] = If[n == 0, {1}, If[i<1, {}, zip[b[n, i-1], Join[{0}, If[Prime[i]>n, {}, b[n-Prime[i], i-1]]]]]]; a[n_] := (l = b[n, PrimePi[n]]; While[Length[l]>0 && l[[-1]] == 0, l = ReplacePart[l, -1 -> Nothing]]; If[Length[l] == 0, 0, l[[-1]]]);  Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Feb 12 2017, translated from Maple *)

Formula

a(n) = A219180(n,A024936(n)) if A024936(n) >= 0, a(n) = 0 else.