login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A014342 Convolution of primes with themselves. 30

%I #44 Sep 08 2022 08:44:39

%S 4,12,29,58,111,188,305,462,679,968,1337,1806,2391,3104,3953,4978,

%T 6175,7568,9185,11030,13143,15516,18177,21150,24471,28152,32197,36678,

%U 41543,46828,52621,58874,65659,73000,80949,89462,98631,108396,118869,130102,142071

%N Convolution of primes with themselves.

%H Reinhard Zumkeller, <a href="/A014342/b014342.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = Sum_{i=1..n} prime(i) * prime(n+1-i), where prime(i) is the i-th prime.

%F G.f.: (b(x)^2)/x, where b(x) is the g.f. of A000040. - _Mario C. Enriquez_, Dec 13 2016

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

%p A014342:=n->add(ithprime(i)*ithprime(n+1-i), i=1..n): seq(A014342(n), n=1..50); # _Wesley Ivan Hurt_, Dec 14 2016

%t Table[Sum[Prime[i] Prime[n + 1 - i], {i, n}], {n, 40}] (* _Michael De Vlieger_, Dec 13 2016 *)

%t Table[With[{p=Prime[Range[n]]},ListConvolve[p,p]],{n,40}]//Flatten (* _Harvey P. Dale_, May 03 2018 *)

%o (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

%o (Haskell)

%o a014342 n = a014342_list !! (n-1)

%o a014342_list= f (tail a000040_list) [head a000040_list] 1 where

%o f (p:ps) qs k = sum (zipWith (*) qs $ reverse qs) :

%o f ps (p : qs) (k + 1)

%o -- _Reinhard Zumkeller_, Apr 07 2014, Mar 08 2012

%o (Magma) [&+[NthPrime(n-i+1)*NthPrime(i): i in [1..n]]: n in [1..40]]; // _Bruno Berselli_, Apr 12 2016

%o (Python)

%o from numpy import convolve

%o from sympy import prime, primerange

%o def aupton(terms):

%o p = list(primerange(2, prime(terms)+1))

%o return list(convolve(p, p))[:terms]

%o print(aupton(41)) # _Michael S. Branicky_, Apr 12 2021

%Y Cf. A000040, A023626, A024697, A025129, A209403.

%Y Column k=2 of A340991.

%K nonn,easy

%O 1,1

%A _N. J. A. Sloane_

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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 18 18:09 EDT 2024. Contains 376002 sequences. (Running on oeis4.)