login
a(n) is the smallest number such that the product a(1)a(2)...a(n) falls between a twin prime pair, starting with a(1)=2.
3

%I #41 Aug 02 2023 14:36:58

%S 2,2,3,5,3,9,6,43,18,41,82,63,47,64,108,41,192,150,91,15,5,20,214,218,

%T 46,180,121,31,80,115,39,88,2,384,1828,1219,360,113,2,1111,559,687,26,

%U 1000,368,3130,1198,1731,1752,1240,1237,131,814,2349,949,64,284,361,120,3398,47,2068,1001

%N a(n) is the smallest number such that the product a(1)a(2)...a(n) falls between a twin prime pair, starting with a(1)=2.

%H Michael De Vlieger, <a href="/A036014/b036014.txt">Table of n, a(n) for n = 1..150</a>

%e 4 between 3,5; 12 between 11,13; 60 between 59,61; etc.

%t d[ 1 ]=2; d[ n_ ] := d[ n ]=Module[ {}, b=Product[ d[ i ], {i, 1, n-1} ]; i=2; While[ Not[ PrimeQ[ i b-1 ]&&PrimeQ[ i b+1 ] ], i++ ]; i ]; Table[ d[ i ], {i, 1, 30} ]

%t (* Second Program: *)

%t Nest[Append[#, Block[{k = 2}, While[! AllTrue[Times @@ #*k + {-1, 1}, PrimeQ], k++]; k]] &, {2}, 62] (* _Michael De Vlieger_, May 15 2018 *)

%o (J) ms =: [: */ ,

%o pp =: [: *./ 1: p: <: , >:

%o ty =: [: pp ms

%o a1 =: ($: >:)`,@.ty

%o 2 (a1~^: 30) 2x NB. _Stephen Makdisi_, May 06 2018

%o (PARI) lista(nn) = {print1(a = 2, ", "); for (n=2, nn, k = 2; while (!(isprime(k*a-1) && isprime(k*a+1)), k++); print1(k, ", "); a *= k;);} \\ _Michel Marcus_, May 06 2018

%Y Cf. A014574 (average of twin primes pairs), A359948, A363274.

%K nonn,nice

%O 1,1

%A _Russell Easterly_

%E More terms from _Erich Friedman_

%E Name edited by and more terms from _Michel Marcus_, May 06 2018