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-10 of 43 results. Next

A265112 a(n) = A023360(A000040(n)): number of compositions of prime(n) into prime parts.

Original entry on oeis.org

1, 1, 3, 6, 20, 46, 232, 501, 2352, 24442, 53243, 550863, 2616338, 5701553, 27077005, 280237217, 2900328380, 6320545915, 65414893802, 310664269401, 677015556295, 7006815193063, 33276323565116, 344395408399372, 7767597342090622, 36889382062795742
Offset: 1

Views

Author

Bob Selcoe, Dec 01 2015

Keywords

Examples

			prime(4) = 7; a(4) = A023360(7) = 6 because there are 6 compositions of 7 into prime parts {2,3,5,7}: {7}, {5+2}, {3+2+2}, {2+5}, {2+3+2} and {2+2+3}.
		

Crossrefs

Cf. A000040 (prime numbers), A023360.

Programs

  • Maple
    N:= 1000: # to get a(1) to a(A000720(N))
    Primes:= select(isprime, [2,seq(i,i=3..N,2)]):
    M:= nops(Primes);
    F:= proc(x)
    option remember;
    local k;
    add(procname(x-Primes[k]),k=1..numtheory:-pi(x));
    end proc:
    F(0):= 1:
    seq(F(Primes[n]),n=1..M); # Robert Israel, Dec 02 2015
  • Mathematica
    Needs["Combinatorica`"]; Table[Length@ Flatten[Permutations[#, {Length@ #}] & /@ Select[Combinatorica`Partitions@ Prime@ n, AllTrue[#, PrimeQ] &], 1], {n, 14}] (* Version 10, slow, or *)
    lim = 101; t = Rest@ CoefficientList[Series[1/(1 - Sum[x^Prime[i], {i, 1, PrimePi@ lim}]), {x, 0, lim}], x]; t[[#]] &@ Prime@ Range@ PrimePi@ lim
    (* Michael De Vlieger, Dec 01 2015, after David W. Wilson at A023360 *)

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.

A280917 Expansion of 1/(1 - x - Sum_{k>=1} x^prime(k)).

Original entry on oeis.org

1, 1, 2, 4, 7, 14, 26, 50, 95, 180, 343, 652, 1240, 2359, 4486, 8532, 16227, 30862, 58697, 111636, 212321, 403814, 768015, 1460691, 2778094, 5283667, 10049027, 19112282, 36349721, 69133673, 131485594, 250072951, 475614693, 904573387, 1720411555, 3272057256, 6223138101, 11835809946, 22510571803, 42812941849
Offset: 0

Views

Author

Ilya Gutkovskiy, Jan 10 2017

Keywords

Comments

Number of compositions (ordered partitions) of n into prime parts (1 included) (A008578).

Examples

			a(4) = 7 because we have [3, 1], [2, 2], [2, 1, 1], [1, 3], [1, 2, 1], [1, 1, 2] and [1, 1, 1, 1].
		

Crossrefs

Programs

  • Mathematica
    nmax = 39; CoefficientList[Series[1/(1 - x - Sum[x^Prime[k], {k, 1, nmax}]), {x, 0, nmax}], x]
  • PARI
    Vec(1 / (1 - x - sum(k=1, 100,  x^prime(k))) + O(x^100)) \\ Indranil Ghosh, Mar 09 2017

Formula

G.f.: 1/(1 - x - Sum_{k>=1} x^prime(k)).

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)).

A280195 Expansion of 1/(1 - Sum_{k>=2} floor(1/omega(k))*x^k), where omega(k) is the number of distinct prime factors (A001221).

Original entry on oeis.org

1, 0, 1, 1, 2, 3, 4, 8, 11, 19, 28, 47, 72, 116, 182, 289, 460, 724, 1153, 1820, 2891, 4572, 7249, 11482, 18190, 28821, 45651, 72338, 114582, 181549, 287596, 455647, 721847, 1143588, 1811748, 2870239, 4547232, 7203907, 11412882, 18080833, 28644680, 45380392, 71894054, 113898439, 180443915, 285869028, 452888824, 717490903, 1136687237
Offset: 0

Views

Author

Ilya Gutkovskiy, Dec 28 2016

Keywords

Comments

Number of compositions (ordered partitions) into prime powers (1 excluded).

Examples

			a(6) = 4 because we have [4, 2], [3, 3], [2, 4] and [2, 2, 2].
		

Crossrefs

Programs

  • Mathematica
    nmax = 48; CoefficientList[Series[1/(1 - Sum[Floor[1/PrimeNu[k]] x^k, {k, 2, nmax}]), {x, 0, nmax}], x]

Formula

G.f.: 1/(1 - Sum_{k>=2} floor(1/omega(k))*x^k).

A002124 Number of compositions of n into a sum of odd primes.

Original entry on oeis.org

1, 0, 0, 1, 0, 1, 1, 1, 2, 1, 3, 4, 3, 7, 7, 8, 14, 15, 21, 28, 33, 47, 58, 76, 103, 125, 169, 220, 277, 373, 476, 616, 810, 1037, 1361, 1763, 2279, 2984, 3846, 5006, 6521, 8428, 10983, 14249, 18480, 24048, 31178, 40520, 52635, 68281, 88765, 115211, 149593, 194381, 252280, 327696, 425587, 552527, 717721
Offset: 0

Views

Author

Keywords

Comments

Arises in studying the Goldbach conjecture.
The g.f. -(z-1)*(z+1)*(z**2+z+1)*(z**2-z+1)/(1-z**6-z**3-z**5-z**7+z**9) conjectured by Simon Plouffe in his 1992 dissertation is wrong.

References

  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    import Data.List (genericIndex)
    a002124 n = genericIndex a002124_list n
    a002124_list = 1 : f 1 [] a065091_list where
       f x qs ps'@(p:ps)
         | p <= x    = f x (p:qs) ps
         | otherwise = sum (map (a002124 . (x -)) qs) : f (x + 1) qs ps'
    -- Reinhard Zumkeller, Mar 21 2014
  • Maple
    A002124 := proc(n) coeff(series(1/(1-add(z^numtheory[ithprime](j),j=2..n)),z=0,n+1),z,n) end;
    M:=120; a:=array(0..M); a[0]:=1; a[1]:=0; a[2]:=0; for n from 3 to M do t1:=0; for k from 2 to n do p := ithprime(k); if p <= n then t1 := t1 + a[n-p]; fi; od: a[n]:=t1; od: [seq(a[n],n=0..M)]; # N. J. A. Sloane, after MacMahon, Dec 03 2006; used in A002125
  • Mathematica
    a[0] = 1; a[1] = a[2] = 0; a[n_] := a[n] = (s = 0; p = 3; While[p <= n, s = s + a[n-p]; p = NextPrime[p]]; s); a /@ Range[0, 58] (* Jean-François Alcover, Jun 28 2011, after P. A. MacMahon *)

Formula

a(0)=1, a(1)=a(2)=0; for n >= 3, a(n) = Sum_{ primes p with 3 <= p <= n} a(n-p). [MacMahon]
G.f.: 1/( 1 - Sum_{k>=2} x^A000040(k) ). [Joerg Arndt, Sep 30 2012]

Extensions

Better description and more terms from Philippe Flajolet, Nov 11 2002
Edited by N. J. A. Sloane, Dec 03 2006

A077608 Number of compositions of n into twin primes (i.e., primes that are members of a twin prime pair, like 3, 5, 7, 11, 13, but not 2 or 23).

Original entry on oeis.org

1, 0, 0, 1, 0, 1, 1, 1, 2, 1, 3, 4, 3, 7, 7, 8, 14, 15, 21, 28, 33, 47, 58, 75, 103, 125, 167, 220, 275, 370, 474, 610, 806, 1028, 1347, 1752, 2253, 2954, 3812, 4944, 6451, 8329, 10841, 14077, 18226, 23720, 30745, 39903, 51857, 67214, 87313, 113340, 147017, 190974
Offset: 0

Views

Author

Philippe Flajolet, Nov 11 2002

Keywords

Examples

			a(15) = 8 since 15 = 11+7 = 7+11 = 5+13 = 13+5 = 3+5+7 = 3+7+5 = 5+3+7 = 5+7+3 = 7+3+5 = 7+5+3 and 3,5,7,11 belong to twin pairs.
		

Crossrefs

Programs

  • Maple
    A077608 := proc(n) coeff(series(1/(1-add(z^numtheory[ithprime](j)* subs([true=1,false=0],evalb(isprime(ithprime(j)-2) or isprime(ithprime(j)+2))),j=2..n+2)),z=0,n+1),z,n): end;
  • Mathematica
    a[n_] := Coefficient[Series[ 1/(1 - Sum[z^Prime[j]*Boole[ PrimeQ[Prime[j] - 2] || PrimeQ[ Prime[j] + 2]], {j, 2, n + 2}]), {z, 0, n + 1}], z, n]; Table[a[n], {n, 0, 53}] (* Jean-François Alcover, Nov 09 2012, after Maple *)
  • PARI
    ok(n)={isprime(n) && (isprime(n-2) || isprime(n+2))}
    {my(n=60); Vec(1/(1-sum(k=1, n, if(ok(k), x^k, 0))) + O(x*x^n))} \\ Andrew Howroyd, Dec 28 2017

Formula

G.f.: 1/(1 - Sum_{k>=1} x^A001097(k)). - Andrew Howroyd, Dec 28 2017

A353401 Number of integer compositions of n with all prime run-lengths.

Original entry on oeis.org

1, 0, 1, 1, 1, 1, 4, 3, 6, 9, 10, 18, 27, 35, 54, 83, 107, 176, 242, 354, 515, 774, 1070, 1648, 2332, 3429, 4984, 7326, 10521, 15591, 22517, 32908, 48048, 70044, 101903, 149081, 216973, 316289, 461959, 672664, 981356, 1431256, 2086901, 3041577, 4439226, 6467735
Offset: 0

Views

Author

Gus Wiseman, May 15 2022

Keywords

Examples

			The a(0) = 1 through a(9) = 9 compositions (empty column indicated by dot, 0 is the empty composition):
  0   .  11   111   22   11111   33     11122     44       333
                                 222    22111     1133     11133
                                 1122   1111111   3311     33111
                                 2211             11222    111222
                                                  22211    222111
                                                  112211   1111122
                                                           1112211
                                                           1122111
                                                           2211111
		

Crossrefs

The case of runs equal to 2 is A003242 aerated.
The <= 1 version is A003242 ranked by A333489.
The version for parts instead of run-lengths is A023360, both A353429.
The version for partitions is A055923.
The > 1 version is A114901, ranked by A353427.
The <= 2 version is A128695, matching A335464.
The > 2 version is A353400, partitions A100405.
Words with all distinct run-lengths: A032020, A044813, A098859, A130091, A329739, A351013, A351017.
A005811 counts runs in binary expansion.
A008466 counts compositions with some part > 2.
A011782 counts compositions.
A167606 counts compositions with adjacent parts coprime.
A329738 counts uniform compositions, partitions A047966.

Programs

  • Maple
    b:= proc(n, h) option remember; `if`(n=0, 1, add(`if`(i<>h, add(
         `if`(isprime(j), b(n-i*j, i), 0), j=2..n/i), 0), i=1..n/2))
        end:
    a:= n-> b(n, 0):
    seq(a(n), n=0..60);  # Alois P. Heinz, May 18 2022
  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],!MemberQ[Length/@Split[#],_?(!PrimeQ[#]&)]&]],{n,0,15}]

Extensions

a(21)-a(45) from Alois P. Heinz, May 18 2022

A347741 Number of compositions (ordered partitions) of n into at most 4 prime parts.

Original entry on oeis.org

1, 0, 1, 1, 1, 3, 2, 6, 6, 10, 15, 15, 24, 25, 31, 36, 35, 45, 50, 55, 63, 69, 73, 90, 91, 99, 113, 114, 130, 143, 144, 153, 166, 159, 195, 179, 213, 191, 253, 216, 279, 236, 288, 247, 343, 248, 377, 275, 397, 318, 456, 307, 503, 342, 524, 401, 572, 379, 641, 396, 667
Offset: 0

Views

Author

Ilya Gutkovskiy, Sep 11 2021

Keywords

Crossrefs

Programs

  • Mathematica
    Table[Length@Flatten[Permutations/@IntegerPartitions[n,4,Prime@Range@PrimePi@n],1],{n,0,60}] (* Giorgos Kalogeropoulos, Sep 12 2021 *)

Formula

a(n) = Sum_{k=1..4} A121303(n,k) for n >= 2. - Alois P. Heinz, Sep 11 2021

A347742 Number of compositions (ordered partitions) of n into at most 5 prime parts.

Original entry on oeis.org

1, 0, 1, 1, 1, 3, 2, 6, 6, 10, 16, 20, 34, 40, 56, 72, 85, 110, 120, 145, 173, 194, 228, 260, 291, 340, 383, 414, 480, 518, 579, 653, 696, 759, 835, 875, 973, 1041, 1093, 1201, 1269, 1406, 1448, 1617, 1593, 1818, 1822, 2035, 1997, 2318, 2166, 2647, 2453, 2897, 2689, 3277
Offset: 0

Views

Author

Ilya Gutkovskiy, Sep 11 2021

Keywords

Crossrefs

Programs

  • Mathematica
    Table[Length@Flatten[Permutations/@IntegerPartitions[n,5,Prime@Range@PrimePi@n],1],{n,0,60}] (* Giorgos Kalogeropoulos, Sep 12 2021 *)

Formula

a(n) = Sum_{k=1..5} A121303(n,k) for n >= 2. - Alois P. Heinz, Sep 11 2021
Showing 1-10 of 43 results. Next