%I #19 Apr 25 2016 11:50:03
%S 2,2,4,8,10,56,46,6,4,102,98,90,52,12,28,418,426,482,38,28,140,26,354,
%T 882,756,268,146,4,260,76,48,288,1584,38,1102,2688,464,3500,16,5146,
%U 2562,2072,1020,726,306,1796,38,866,508,800,3480,132,750,4170
%N Smallest k > 1 such that prime(n)*k^prime(n)-1 is prime.
%C Start:
%C For primes, p < 25,000, for which p*k^p-1 is a prime:
%C k=1: just 3;
%C k=2: 2, 3, 751, 12379, …, ; indices: 1, 2, 133, 1478, …, ;
%C k=4: 2, 3, 5, 23, 107, 1973, 20747, …, ; indices: 1, 2, 3, 9, 28, 298, 2336, …, ;
%C k=6: 2, 3, 19, 107, 1999, …, ; indices: 1, 2, 8, 28, 303, …, ;
%C k=8: 2, 7, …, ; indices: 1, 4, …, ;
%C k=10: 2, 3, 11, 2843, …, ; indices: 1, 2, 5, 413, …, ; etc.
%C End. - _Robert G. Wilson v_, Aug 02 2014
%H Pierre CAMI, <a href="/A245597/b245597.txt">Table of n, a(n) for n = 1..300</a>
%e 2*2^2-1=7 prime so a(1)=2.
%e 3*2^3-1=23 prime so a(2)=2.
%e 5*2^5-1=159 composite.
%e 5*4^5-1=5119 prime so a(3)=4.
%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 02 2014 *)
%o (PFGW & SCRIPT)
%o SCRIPT
%o DIM i,0
%o DIM j
%o DIM n,-1
%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+=2); k
%o vector(20, n, a(n)) \\ _Colin Barker_, Jul 27 2014
%Y Cf. A245598.
%K nonn
%O 1,1
%A _Pierre CAMI_, Jul 27 2014
%E Definition corrected by _Colin Barker_, Jul 27 2014