# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a051956 Showing 1-1 of 1 %I A051956 #20 Oct 12 2022 04:31:23 %S A051956 4,15,17,19,29,57,77,285,318,354,379,405,520,521,595,625,938,1706, %T A051956 1738,2085,2345,2817,4319,4529,7005,8207,8232,9451,9839,11044,11170, %U A051956 12386,12421,12722,14153,15220,15371,17052,17965,18279,18811,19890,21628,22667,22746 %N A051956 a(n) = smallest number > a(n-1) such that a(1)*a(2)*...*a(n) + 1 and a(1)*a(2)*...*a(n) - 1 are primes. %H A051956 Amiram Eldar, Table of n, a(n) for n = 1..184 %t A051956 a[1] = 4; a[n_] := a[n] = For[k = a[n-1]+1, True, k++, p = Times @@ Array[a, n-1]; If[PrimeQ[k*p+1] && PrimeQ[k*p-1], Print[k]; Return[k]]]; Array[a, 45] (* _Jean-François Alcover_, Oct 23 2016 *) %o A051956 (PARI) lista(nn) = {my (v = vector(nn)); for (n = 1, nn, if (n == 1, p = 1; k = 0; , p = prod(j=1, n-1, v[j]); k = v[n-1]+1); while (! isprime(p*k+1) || ! isprime(p*k-1), k++); v[n] = k; print1(k, ", "););} \\ _Michel Marcus_, Sep 28 2013 %Y A051956 Cf. A051935, A051957. %K A051956 nice,nonn %O A051956 1,1 %A A051956 _Felice Russo_, Dec 21 1999 %E A051956 More terms from _Michel Marcus_, Sep 28 2013 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE