OFFSET
1,1
COMMENTS
Start:
For primes, p < 25000, for which p*k^p-1 is a prime:
k=1: only the first prime, 2;
k=2: none;
k=3: only the first prime, 2;
k=4: 3, 7, 67, 223, …, ; indices: 2, 4, 19, 48, …, ;
k=6: 2, 9901, 12043, …, ; indices: 1, 1221, 1443, …, ;
k=8: 5, 17, 23, …, ; indices: 3, 7, 9, …, ;
k=9 only for the first prime, 2;
k=10: 3, 2161, …, ; indices: 2, 326, …, ; etc.
End. - Robert G. Wilson v, Aug 05 2014
LINKS
Pierre CAMI, Table of n, a(n) for n = 1..300
EXAMPLE
2*2^2+1=9 composite.
2*3^2+1=19 prime so a(1)=3.
MATHEMATICA
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 *)
PROG
(PFGW & SCRIPT)
SCRIPT
DIM i, 1
DIM j
DIM n
DIMS t
OPENFILEOUT myf, a(n).txt
LABEL loop1
SET i, i+1
IF i>300 THEN END
SET j, p(i)
SET n, 0
LABEL loop2
SET n, n+2
SETS t, %d, %d, %d\,; i; j; n
PRP j*n^j+1, t
IF ISPRP THEN GOTO a
GOTO loop2
LABEL a
WRITE myf, t
GOTO loop1
(PARI) a(n) = k=2; while(!isprime(prime(n)*k^prime(n)+1), k++); k
vector(40, n, a(n)) \\ Colin Barker, Jul 30 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierre CAMI, Jul 27 2014
EXTENSIONS
Definition corrected by Zak Seidov, Jul 27 2014
STATUS
approved