login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) is the smallest positive integer such that (the n-th prime)+a(n)! is prime, or -1 if no such prime exists.
4

%I #20 Dec 02 2017 10:14:21

%S 1,2,2,3,2,3,2,4,3,2,3,3,2,4,3,3,2,3,3,2,3,4,3,4,3,2,3,2,5,4,4,3,2,4,

%T 2,3,3,5,3,3,2,9,2,3,2,4,5,3,2,5,3,2,7,3,3,3,2,3,3,2,4,4,3,2,4,8,3,5,

%U 2,4,3,4,3,3,5,3,5,4,5,4,2,5,2,3,4,3,5,3,2,4,4,4,5,7,4,3,6,2,4,3,4,3,3,2,3

%N a(n) is the smallest positive integer such that (the n-th prime)+a(n)! is prime, or -1 if no such prime exists.

%C A175194(n) = a(n)!.

%H Michael De Vlieger, <a href="/A175193/b175193.txt">Table of n, a(n) for n = 1..10000</a>

%H Michael De Vlieger, <a href="/A175193/a175193.txt">First positions of values and records in a(n).</a>

%F A092789(n) = A000040(n) + a(n)!.

%e From _Michael De Vlieger_, Nov 24 2017: (Start)

%e Records and their indices in a(n):

%e i n a(n)

%e --------------------

%e 1 1 1

%e 2 2 2

%e 3 4 3

%e 4 8 4

%e 5 29 5

%e 6 42 9

%e 7 233 10

%e 8 254 42

%e 9 4508 49

%e 10 7003 124

%e 11 7385 276

%e 12 60650 311

%e 13 97146 542

%e (End)

%t Fold[Append[#1, SelectFirst[Range[12], Function[k, PrimeQ[Prime[#2] + k!]]]] &, {1}, Range[2, 105]] (* _Michael De Vlieger_, Nov 24 2017 *)

%o (PARI) a(n) = {my(k = 1, p = prime(n)); while (!isprime(p + k!), k++); k;} \\ _Michel Marcus_, Nov 25 2017

%Y Cf. A082470, A092789, A175194.

%K nonn

%O 1,2

%A _Leroy Quet_, Mar 01 2010

%E Extended by _Ray Chandler_, Mar 04 2010