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-8 of 8 results.

A357368 Triangle read by rows. Convolution triangle of the prime indicator sequence A089026.

Original entry on oeis.org

1, 0, 1, 0, 2, 1, 0, 3, 4, 1, 0, 1, 10, 6, 1, 0, 5, 14, 21, 8, 1, 0, 1, 23, 47, 36, 10, 1, 0, 7, 28, 90, 108, 55, 12, 1, 0, 1, 49, 147, 258, 205, 78, 14, 1, 0, 1, 46, 249, 520, 595, 346, 105, 16, 1, 0, 1, 75, 360, 978, 1437, 1185, 539, 136, 18, 1
Offset: 0

Views

Author

Peter Luschny, Oct 03 2022

Keywords

Comments

To clarify our terminology: We say T is the convolution triangle of a (or T is the partition transform of a), if a is a sequence of integers defined for n >= 1, and the transformation, as defined by the Maple function below, applied to a, returns T. In the generated lower triangular matrix T, i.e., in the convolution triangle of a, T(n, 1) = a(n) for n >= 1.
For instance, let a(n) = Bell(n), then we call A357583 the convolution triangle of the Bell numbers, but not A205574, which is also called the "Bell convolution triangle" in the comments but leads to a different triangle. Similarly, if a(n) = n!, then A090238 is the convolution triangle of the factorial numbers, not A084938. Third example: A128899 is the convolution triangle of the Catalan numbers in our setup, not A059365. More generally, we recommend that when computing the transform of a 0-based sequence to use only the terms for n >= 1 and not to shift the sequence.
Note that T is (0, 0)-based and the first column of a convolution triangle always is 1, 0, 0, 0, ... and the main diagonal is 1, 1, 1, 1, ... if a(1) = 1. The (1, 1)-based subtriangle of a genuine convolution triangle, i.e., a convolution triangle without column 0 and row 0, is often used in place of the convolution triangle but does not fit well into some applications of the convolution triangles.

Examples

			Triangle T(n, k) starts:
[0] 1;
[1] 0, 1;
[2] 0, 2,  1;
[3] 0, 3,  4,   1;
[4] 0, 1, 10,   6,   1;
[5] 0, 5, 14,  21,   8,   1;
[6] 0, 1, 23,  47,  36,  10,   1;
[7] 0, 7, 28,  90, 108,  55,  12,   1;
[8] 0, 1, 49, 147, 258, 205,  78,  14,  1;
[9] 0, 1, 46, 249, 520, 595, 346, 105, 16, 1;
		

Crossrefs

Programs

  • Maple
    PMatrix := proc(dim, a) local n, k, m, g, M, A;
       if n = 0 then return [1] fi;
       A := [seq(a(i), i = 1..dim-1)];
       M := Matrix(dim, shape=triangular[lower]); M[1, 1] := 1;
       for m from 2 to dim do
           M[m, m] := M[m - 1, m - 1] * A[1];
           for k from m-1 by -1 to 2 do
               M[m, k] := add(A[i]*M[m-i, k-1], i = 1..m-k+1)
    od od; M end:
    a := n -> if isprime(n) then n else 1 fi: PMatrix(10, a);
    # Alternatively, as the coefficients of row polynomials:
    P := proc(n, x, a) option remember; ifelse(n = 0, 1,
        x*add(a(n - k)*P(k, x, a), k = 0..n-1)) end:
    Pcoeffs := proc(n, a) seq(coeff(P(n, x, a), x, k), k=0..n) end:
    seq(Pcoeffs(n, a), n = 0..9);
    # Alternatively, term by term:
    T := proc(n, k, a) option remember; # Alois P. Heinz style
        `if`(k=0, `if`(n=0, 1, 0), `if`(k=1, `if`(n=0, 0, a(n)),
        (q->add(T(j, q, a)*T(n-j, k-q, a), j=0..n))(iquo(k, 2)))) end:
    seq(seq(T(n, k, a), k=0..n), n=0..9);
  • Mathematica
    PMatrix[dim_, a_] := Module[{n, k, m, g, M, A}, If[n == 0, Return[1]]; A = Array[a, dim-1]; M = Array[0&, {dim, dim}]; M[[1, 1]] = 1; For[m = 2, m <= dim, m++, M[[m, m]] = M[[m-1, m-1]]*A[[1]]; For[k = m-1, k >= 2, k--, M[[m, k]] = Sum[A[[i]]*M[[m-i, k-1]], {i, 1, m-k+1}]]]; M];
    a[n_] :=  If[PrimeQ[n], n, 1];
    nmax = 10;
    PM = PMatrix[nmax+1, a];
    T[n_, k_] := PM[[n+1, k+1]];
    Table[T[n, k], {n, 0, nmax}, {k, 0, n}] // Flatten (* Jean-François Alcover, Oct 21 2022 *)
  • Python
    def ConvTriangle(dim: int, a) -> list[list[int]]:
        if callable(a): # Cache the input sequence.
            A = [a(i) for i in range(1, dim)]
        else:
            A = a
        print("In:", A)
        C = [[0 for k in range(m + 1)] for m in range(dim)]
        C[0][0] = 1
        for m in range(1, dim):
            C[m][m] = C[m - 1][m - 1] * A[0]
            for k in range(m - 1, 0, -1):
                C[m][k] = sum(A[i] * C[m - i - 1][k - 1] for i in range(m - k + 1))
        return C
    from sympy import isprime, flatten
    def a(n): return n if isprime(n) else 1
    print(flatten(ConvTriangle(10, a)))

A014342 Convolution of primes with themselves.

Original entry on oeis.org

4, 12, 29, 58, 111, 188, 305, 462, 679, 968, 1337, 1806, 2391, 3104, 3953, 4978, 6175, 7568, 9185, 11030, 13143, 15516, 18177, 21150, 24471, 28152, 32197, 36678, 41543, 46828, 52621, 58874, 65659, 73000, 80949, 89462, 98631, 108396, 118869, 130102, 142071
Offset: 1

Views

Author

Keywords

Examples

			a(2)=12 because a(2) = prime(1)*prime(2) + prime(2)*prime(1) = 2*3 + 3*2 = 12.
		

Crossrefs

Column k=2 of A340991.

Programs

  • Haskell
    a014342 n = a014342_list !! (n-1)
    a014342_list= f (tail a000040_list) [head a000040_list] 1 where
       f (p:ps) qs k = sum (zipWith (*) qs $ reverse qs) :
                       f ps (p : qs) (k + 1)
    -- Reinhard Zumkeller, Apr 07 2014, Mar 08 2012
    
  • Magma
    [&+[NthPrime(n-i+1)*NthPrime(i): i in [1..n]]: n in [1..40]]; // Bruno Berselli, Apr 12 2016
    
  • Maple
    A014342:=n->add(ithprime(i)*ithprime(n+1-i), i=1..n): seq(A014342(n), n=1..50); # Wesley Ivan Hurt, Dec 14 2016
  • Mathematica
    Table[Sum[Prime[i] Prime[n + 1 - i], {i, n}], {n, 40}] (* Michael De Vlieger, Dec 13 2016 *)
    Table[With[{p=Prime[Range[n]]},ListConvolve[p,p]],{n,40}]//Flatten (* Harvey P. Dale, May 03 2018 *)
  • PARI
    {m=40;u=vector(m,x,prime(x));for(n=1,m,v=vecextract(u,concat("1..",n)); w=vector(n,x,u[n+1-x]);print1(v*w~,","))} \\ Klaus Brockhaus, Apr 28 2004
    
  • Python
    from numpy import convolve
    from sympy import prime, primerange
    def aupton(terms):
      p = list(primerange(2, prime(terms)+1))
      return list(convolve(p, p))[:terms]
    print(aupton(41)) # Michael S. Branicky, Apr 12 2021

Formula

a(n) = Sum_{i=1..n} prime(i) * prime(n+1-i), where prime(i) is the i-th prime.
G.f.: (b(x)^2)/x, where b(x) is the g.f. of A000040. - Mario C. Enriquez, Dec 13 2016

Extensions

More terms from Felix Goldberg (felixg(AT)tx.technion.ac.il), Feb 01 2001

A030018 Coefficients in 1/(1+P(x)), where P(x) is the generating function of the primes.

Original entry on oeis.org

1, -2, 1, -1, 2, -3, 7, -10, 13, -21, 26, -33, 53, -80, 127, -193, 254, -355, 527, -764, 1149, -1699, 2436, -3563, 5133, -7352, 10819, -15863, 23162, -33887, 48969, -70936, 103571, -150715, 219844, -320973, 466641, -679232, 988627, -1437185, 2094446, -3052743
Offset: 0

Views

Author

Keywords

Comments

a(n+1)/a(n) => ~-1.456074948582689671... (see A072508). - Zak Seidov, Oct 01 2011

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=0, 1,
          -add(ithprime(n-i)*a(i), i=0..n-1))
        end:
    seq(a(n), n=0..70);  # Alois P. Heinz, Jun 13 2018
  • Mathematica
    max = 50; P[x_] := 1 + Sum[Prime[n]*x^n, {n, 1, max}]; s = Series[1/P[x], {x, 0, max}]; CoefficientList[s, x] (* Jean-François Alcover, Sep 24 2014 *)
  • PARI
    v=[];for(n=1,50,v=concat(v,-prime(n)-sum(i=1,n-1,prime(i)*v[#v-i+1])));v \\ Derek Orr, Apr 28 2015

Formula

Apply inverse of "INVERT" transform to primes: INVERT: a's from b's in 1+Sum a_i x^i = 1/(1-Sum b_i x^i).
a(n) = -prime(n) - Sum_{i=1..n-1} prime(i)*a(n-i), for n > 0. - Derek Orr, Apr 28 2015
a(n) = Sum_{k=0..n} (-1)^k * A340991(n,k). - Alois P. Heinz, Feb 01 2021

A030017 a(1) = 1, a(n+1) = Sum_{k = 1..n} p(k)*a(n+1-k), where p(k) is the k-th prime.

Original entry on oeis.org

1, 2, 7, 25, 88, 311, 1095, 3858, 13591, 47881, 168688, 594289, 2093693, 7376120, 25986209, 91549913, 322532092, 1136286727, 4003159847, 14103208628, 49685873471, 175044281583, 616684348614, 2172590743211, 7654078700221, 26965465508072, 94999850216565
Offset: 1

Views

Author

Keywords

Comments

Apply "INVERT" transform to primes.

Examples

			a(5) = 25*2 +7*3 +2*5 + 1*7 = 88.
		

Crossrefs

Row sums of A340991(n-1).
Cf. A000040.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=1, 1,
          add(a(n-i)*ithprime(i), i=1..n-1))
        end:
    seq(a(n), n=1..29);  # Alois P. Heinz, Feb 10 2021
  • Mathematica
    CoefficientList[ Series[ 1/(1 - Sum[ Prime[ n ]*x^n, {n, 1, 25} ] ), {x, 0, 25} ], x ]
    (* Second program: *)
    a[1] = 1; a[m_] := a[m] = Sum[Prime@ k  a[m - k], {k, m - 1}]; Table[a@ n, {n, 25}] (* Michael De Vlieger, Dec 13 2016 *)

Formula

INVERT: a's from b's in 1+Sum a_i x^i = 1/(1-Sum b_i x^i).
G.f: (1-b(x)/(b(x)-1))*x, where b(x) is the g.f. of A000040. - Mario C. Enriquez, Dec 13 2016

A030281 COMPOSE natural numbers with primes.

Original entry on oeis.org

2, 11, 53, 237, 1013, 4196, 16992, 67647, 265743, 1032827, 3979023, 15217248, 57835016, 218636365, 822691425, 3083074193, 11512489353, 42851360088, 159043175322, 588767623587, 2174488780469, 8013945343961, 29477541831841, 108233492257428, 396751988675780
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Maple
    b:= proc(n) option remember; `if`(n=0, [1, 0], (p->
          p+[0, p[1]])(add(ithprime(j)*b(n-j), j=1..n)))
        end:
    a:= n-> b(n)[2]:
    seq(a(n), n=1..27);  # Alois P. Heinz, Sep 11 2019
  • Mathematica
    b[n_] := b[n] = If[n==0, {1, 0}, #+{0, #[[1]]}&[Sum[Prime[j] b[n-j], {j, 1, n}]]];
    a[n_] := b[n][[2]];
    Array[a, 27] (* Jean-François Alcover, Nov 09 2020, after Alois P. Heinz *)

Formula

G.f.: Sum_{j>=1} j*(Sum_{k>=1} prime(k)*x^k)^j. - Ilya Gutkovskiy, Apr 21 2019
a(n) = Sum_{k=0..n} k * A340991(n,k). - Alois P. Heinz, Feb 01 2021

A340990 a(n) is the (2n)-th term of the n-fold self-convolution of the primes.

Original entry on oeis.org

1, 3, 29, 291, 3121, 34123, 379853, 4280251, 48681569, 557686227, 6425630909, 74384480019, 864461820049, 10079577033243, 117859582680813, 1381492094548651, 16227770995740865, 190979248798795427, 2251327736286726749, 26579050506578504195, 314212180691846338801
Offset: 0

Views

Author

Alois P. Heinz, Feb 01 2021

Keywords

Crossrefs

Programs

  • Maple
    b:= proc(n, k) option remember; `if`(k=0, 1, `if`(k=1, ithprime(n+1),
          (q-> add(b(j, q)*b(n-j, k-q), j=0..n))(iquo(k, 2))))
        end:
    a:= n-> b(n$2):
    seq(a(n), n=0..23);
  • Mathematica
    b[n_, k_] := b[n, k] = If[k == 0, 1, If[k == 1, Prime[n + 1], With[{q = Quotient[k, 2]}, Sum[b[j, q] b[n - j, k - q], {j, 0, n}]]]];
    a[n_] := b[n, n];
    a /@ Range[0, 23] (* Jean-François Alcover, Feb 04 2021, after Alois P. Heinz *)

Formula

a(n) = [x^(2n)] (Sum_{j>=1} prime(j)*x^j)^n.
a(n) = A340991(2n,n).

A014343 Three-fold convolution of primes with themselves.

Original entry on oeis.org

8, 36, 114, 291, 669, 1386, 2678, 4851, 8373, 13858, 22134, 34263, 51635, 75972, 109374, 154483, 214383, 292812, 394148, 523521, 686901, 891112, 1143936, 1454187, 1831973, 2288400, 2836044, 3488969, 4262541, 5173836, 6241612, 7486437, 8930649, 10598848
Offset: 0

Views

Author

Keywords

Crossrefs

Column k=3 of A340991.

Programs

  • Mathematica
    Table[Sum[Prime[k + 1] Sum[Prime[i] Prime[# + 1 - i], {i, #}] &[n - k + 1], {k, 0, n}], {n, 0, 26}] (* Michael De Vlieger, Dec 13 2016 *)

Formula

From Mario C. Enriquez, Dec 13 2016: (Start)
G.f: (b(x)^3)/(x^2), where b(x) is the g.f. of A000040.
a(n) = Sum_{k=0..n} A014342(n-k+1)*A000040(k+1).
(End)

A014344 Four-fold convolution of primes with themselves.

Original entry on oeis.org

16, 96, 376, 1160, 3121, 7532, 16754, 34796, 68339, 127952, 229956, 398688, 669781, 1094076, 1742710, 2713604, 4139111, 6195712, 9115304, 13199072, 18833449, 26509260, 36843322, 50603884, 68740107, 92414192, 123039628, 162323200, 212312453, 275448380
Offset: 0

Views

Author

Keywords

Crossrefs

Column k=4 of A340991.

Programs

  • Maple
    b:= proc(n, k) option remember; `if`(k=1, ithprime(n+1),
          add(b(j, floor(k/2))*b(n-j, ceil(k/2)), j=0..n))
        end:
    a:= n-> b(n, 4):
    seq(a(n), n=0..35);  # Alois P. Heinz, Mar 10 2018
  • Mathematica
    b[n_, k_] := b[n, k] = If[k==1, Prime[n+1], Sum[b[j, Floor[k/2]] b[n-j, Ceiling[k/2]], {j, 0, n}]];
    a[n_] := b[n, 4];
    a /@ Range[0, 35] (* Jean-François Alcover, Nov 16 2020, after Alois P. Heinz *)
  • PARI
    my(N = 50, x = 'x + O('x^N)); Vec(((1/x)*sum(k=1, N, prime(k)*x^k))^4) \\ Michel Marcus, Mar 10 2018

Formula

G.f.: ((1/x)*Sum_{k>=1} prime(k)*x^k)^4. - Ilya Gutkovskiy, Mar 10 2018
Showing 1-8 of 8 results.