Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #33 Apr 25 2016 11:50:03
%S 3,4,8,4,42,60,8,198,8,54,130,778,108,178,924,44,180,706,4,170,474,30,
%T 480,1578,214,416,34,132,2940,60,834,666,336,168,408,216,538,114,60,
%U 266,188,58,36,1504,4868,2398,430,4,1940,408,2036,3038,1146,1902
%N Smallest k > 1 such that prime(n)*k^prime(n)+1 is prime.
%C Start:
%C For primes, p < 25000, for which p*k^p-1 is a prime:
%C k=1: only the first prime, 2;
%C k=2: none;
%C k=3: only the first prime, 2;
%C k=4: 3, 7, 67, 223, …, ; indices: 2, 4, 19, 48, …, ;
%C k=6: 2, 9901, 12043, …, ; indices: 1, 1221, 1443, …, ;
%C k=8: 5, 17, 23, …, ; indices: 3, 7, 9, …, ;
%C k=9 only for the first prime, 2;
%C k=10: 3, 2161, …, ; indices: 2, 326, …, ; etc.
%C End. - _Robert G. Wilson v_, Aug 05 2014
%H Pierre CAMI, <a href="/A245598/b245598.txt">Table of n, a(n) for n = 1..300</a>
%e 2*2^2+1=9 composite.
%e 2*3^2+1=19 prime so a(1)=3.
%t f[n_] := Block[{k = 2, p = Prime@ n}, While[ !PrimeQ[p*k^p - 1], k += 2]; k]; Array[f, 60] (* _Robert G. Wilson v_, Aug 27 2014 *)
%o (PFGW & SCRIPT)
%o SCRIPT
%o DIM i,1
%o DIM j
%o DIM n
%o DIMS t
%o OPENFILEOUT myf,a(n).txt
%o LABEL loop1
%o SET i,i+1
%o IF i>300 THEN END
%o SET j,p(i)
%o SET n,0
%o LABEL loop2
%o SET n,n+2
%o SETS t,%d,%d,%d\,;i;j;n
%o PRP j*n^j+1,t
%o IF ISPRP THEN GOTO a
%o GOTO loop2
%o LABEL a
%o WRITE myf,t
%o GOTO loop1
%o (PARI) a(n) = k=2; while(!isprime(prime(n)*k^prime(n)+1), k++); k
%o vector(40, n, a(n)) \\ _Colin Barker_, Jul 30 2014
%Y Cf. A245597.
%K nonn
%O 1,1
%A _Pierre CAMI_, Jul 27 2014
%E Definition corrected by _Zak Seidov_, Jul 27 2014