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.

Showing 1-5 of 5 results.

A052284 Number of compositions of n into nonprime numbers.

Original entry on oeis.org

1, 1, 1, 1, 2, 3, 5, 7, 11, 17, 27, 40, 61, 92, 142, 217, 333, 506, 774, 1181, 1807, 2758, 4215, 6434, 9833, 15019, 22948, 35047, 53541, 81780, 124936, 190841, 291532, 445320, 680274, 1039155, 1587405, 2424849, 3704148, 5658321, 8643530
Offset: 0

Views

Author

Robert G. Wilson v, May 16 2002

Keywords

Comments

Starting at n=1, appears to be row sums of triangle A157424. - Gary W. Adamson & Mats Granvik, Feb 28 2009

Examples

			a(6) = 5 because 1+1+1+1+1+1 = 1+1+4 = 1+4+1 = 4+1+1 = 6.
		

Crossrefs

Cf. A002095 (Number of partitions of n into nonprime parts).
Column k=0 of A224344.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=0, 1, add(
          `if`(isprime(j), 0, a(n-j)), j=1..n))
        end:
    seq(a(n), n=0..45);  # Alois P. Heinz, Aug 06 2019
  • Mathematica
    nn=50; np=Select[Range[nn], !PrimeQ[ # ] &]; CoefficientList[Series[1/(1-Sum[x^k, {k, np}]), {x, 0, nn}], x] (* T. D. Noe, Aug 20 2010 *)

Formula

G.f.: 1/( 1 - (Sum_{m nonprime} x^m) ).

Extensions

Definition and g.f. corrected by N. J. A. Sloane, Aug 19 2010, who thanks Vladimir Kruchinin for pointing out the errors.

A121303 Triangle read by rows: T(n,k) is the number of compositions of n into k primes (i.e., ordered sequences of k primes having sum n; n>=2, k>=1).

Original entry on oeis.org

1, 1, 0, 1, 1, 2, 0, 1, 1, 1, 2, 3, 0, 2, 3, 1, 0, 2, 4, 4, 0, 3, 6, 6, 1, 1, 0, 6, 8, 5, 0, 2, 9, 13, 10, 1, 1, 2, 6, 16, 15, 6, 0, 3, 6, 22, 25, 15, 1, 0, 2, 10, 24, 36, 26, 7, 0, 4, 9, 22, 50, 45, 21, 1, 1, 0, 12, 32, 65, 72, 42, 8, 0, 4, 12, 34, 70, 106, 77, 28, 1, 1, 2, 12, 40, 90, 150
Offset: 2

Views

Author

Emeric Deutsch, Aug 06 2006

Keywords

Comments

Row n has floor(n/2) terms.
Sum of terms in row n = A023360(n).
T(n,1) = A010051(n) (characteristic function of primes); T(n,2) = A073610(n); T(n,3) = A098238(n).
Sum_{k=1..floor(n/2)} k*T(n,k) = A121304(n).

Examples

			T(9,3) = 4 because we have [2,2,5], [2,5,2], [5,2,2] and [3,3,3].
Triangle starts:
  1;
  1;
  0, 1;
  1, 2;
  0, 1, 1;
  1, 2, 3;
  0, 2, 3, 1;
  0, 2, 4, 4;
  ...
		

Crossrefs

Programs

  • Maple
    G:=1/(1-t*sum(z^ithprime(i),i=1..30))-1: Gser:=simplify(series(G,z=0,25)): for n from 2 to 21 do P[n]:=sort(coeff(Gser,z,n)) od: for n from 2 to 21 do seq(coeff(P[n],t,j),j=1..floor(n/2)) od; # yields sequence in triangular form
    # second Maple program:
    with(numtheory):
    b:= proc(n) option remember; local j; if n=0 then [1]
          else []; for j to pi(n) do zip((x, y)->x+y, %,
          [0, b(n-ithprime(j))[]], 0) od; % fi
        end:
    T:= n-> subsop(1=NULL, b(n))[]:
    seq(T(n), n=2..20);  # Alois P. Heinz, May 23 2013
  • Mathematica
    nn=20;a[x_]:=Sum[x^Prime[n],{n,1,nn}];CoefficientList[Series[1/(1-y a[x]),{x,0,nn}],{x,y}]//Grid (* Geoffrey Critzer, Nov 08 2013 *)

Formula

G.f.: 1/(1 - t*Sum_{i>=1} z^prime(i)).

A102291 Total number of prime parts in all compositions of n.

Original entry on oeis.org

0, 0, 1, 3, 7, 18, 42, 98, 222, 497, 1100, 2413, 5250, 11350, 24398, 52193, 111180, 235949, 499074, 1052502, 2213710, 4644833, 9724492, 20318637, 42376578, 88231765, 183420748, 380755932, 789340736, 1634339217, 3379993922, 6982618822, 14410499598, 29711523105
Offset: 0

Views

Author

Vladeta Jovovic, Feb 19 2005

Keywords

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=0, 0, add(a(n-j)+
          `if`(isprime(j), ceil(2^(n-j-1)), 0), j=1..n))
        end:
    seq(a(n), n=0..33);  # Alois P. Heinz, Aug 06 2019
  • Mathematica
    a[n_] := a[n] = If[n==0, 0, Sum[a[n-j] + If[PrimeQ[j], Ceiling[2^(n-j-1)], 0], {j, 1, n}]];
    a /@ Range[0, 33] (* Jean-François Alcover, Oct 30 2020, after Alois P. Heinz *)

Formula

G.f.: Sum_{k>=1} x^prime(k)*(1-x)^2/(1-2*x)^2.
a(n) = Sum_{k=1..floor(n/2)} k * A224344(n,k). - Alois P. Heinz, Aug 06 2019

Extensions

More terms from Joshua Zucker, May 10 2006

A222656 Number T(n,k) of partitions of n using exactly k primes; triangle T(n,k), n>=0, 0<=k<=floor(n/2), read by rows.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 2, 2, 1, 2, 3, 2, 3, 4, 3, 1, 3, 6, 4, 2, 5, 7, 6, 3, 1, 6, 9, 8, 5, 2, 8, 11, 12, 7, 3, 1, 8, 17, 14, 10, 5, 2, 12, 20, 19, 14, 8, 3, 1, 13, 26, 25, 19, 11, 5, 2, 17, 31, 35, 24, 16, 8, 3, 1, 19, 41, 42, 34, 21, 12, 5, 2, 26, 47, 56, 44, 29
Offset: 0

Views

Author

Alois P. Heinz, May 29 2013

Keywords

Examples

			T(6,0) = 3: [6], [4,1,1], [1,1,1,1,1,1].
T(6,1) = 4: [5,1], [4,2], [3,1,1,1], [2,1,1,1,1].
T(6,2) = 3: [3,3], [3,2,1], [2,2,1,1].
T(6,3) = 1: [2,2,2].
Triangle T(n,k) begins:
  1;
  1;
  1,  1;
  1,  2;
  2,  2,  1;
  2,  3,  2;
  3,  4,  3,  1;
  3,  6,  4,  2;
  5,  7,  6,  3, 1;
  6,  9,  8,  5, 2;
  8, 11, 12,  7, 3, 1;
  8, 17, 14, 10, 5, 2;
  ...
		

Crossrefs

Column k=0 gives: A002095.
Row sums give: A000041.

Programs

  • Maple
    b:= proc(n, i) option remember; local j; if n=0 then 1 elif i<1 then 0
          else []; for j from 0 to n/i do zip((x, y)->x+y, %,
          [`if`(isprime(i), 0$j, NULL), b(n-i*j, i-1)], 0) od; %[] fi
        end:
    T:= n-> b(n$2):
    seq(T(n), n=0..16);
  • Mathematica
    zip[f_, x_List, y_List, z_] := With[{m = Max[Length[x], Length[y]]}, Thread[f[PadRight[x, m, z], PadRight[y, m, z]]]]; b[n_, i_] := b[n, i] = Module[{j, pc}, Which[n == 0, {1}, i<1, {0}, True, pc = {}; For[j = 0, j <= n/i, j++, pc = zip[Plus, pc, Join[If[PrimeQ[i], Array[0&, j], {}], b[n-i*j, i-1]], 0]]; pc]]; T[n_] := b[n, n]; Table[T[n], {n, 0, 16}] // Flatten (* Jean-François Alcover, Jan 29 2014, after Alois P. Heinz *)

Formula

Sum_{k=1..floor(n/2)} k * T(n,k) = A037032(n).
G.f.: G(t,x) = Product_{i>=1} (1 - x^prime(i))/((1 - x^i)*(1 - t*x^prime(i))). - Emeric Deutsch, Nov 11 2015

A299168 Number of ordered ways of writing n-th prime number as a sum of n primes.

Original entry on oeis.org

1, 0, 0, 0, 5, 6, 42, 64, 387, 5480, 10461, 113256, 507390, 1071084, 4882635, 44984560, 382362589, 891350154, 7469477771, 33066211100, 78673599501, 649785780710, 2884039365010, 22986956007816, 306912836483025, 1361558306986280, 3519406658042964
Offset: 1

Views

Author

Ilya Gutkovskiy, Feb 04 2018

Keywords

Examples

			a(5) = 5 because fifth prime number is 11 and we have [3, 2, 2, 2, 2], [2, 3, 2, 2, 2], [2, 2, 3, 2, 2], [2, 2, 2, 3, 2] and [2, 2, 2, 2, 3].
		

Crossrefs

Programs

  • Maple
    b:= proc(n, t) option remember;
          `if`(n=0, `if`(t=0, 1, 0), `if`(t<1, 0, add(
          `if`(isprime(j), b(n-j, t-1), 0), j=1..n)))
        end:
    a:= n-> b(ithprime(n), n):
    seq(a(n), n=1..30);  # Alois P. Heinz, Feb 13 2021
  • Mathematica
    Table[SeriesCoefficient[Sum[x^Prime[k], {k, 1, n}]^n, {x, 0, Prime[n]}], {n, 1, 27}]

Formula

a(n) = [x^prime(n)] (Sum_{k>=1} x^prime(k))^n.
Showing 1-5 of 5 results.