OFFSET
1,1
COMMENTS
Start:
For primes, p < 25,000, for which p*k^p-1 is a prime:
k=1: just 3;
k=2: 2, 3, 751, 12379, …, ; indices: 1, 2, 133, 1478, …, ;
k=4: 2, 3, 5, 23, 107, 1973, 20747, …, ; indices: 1, 2, 3, 9, 28, 298, 2336, …, ;
k=6: 2, 3, 19, 107, 1999, …, ; indices: 1, 2, 8, 28, 303, …, ;
k=8: 2, 7, …, ; indices: 1, 4, …, ;
k=10: 2, 3, 11, 2843, …, ; indices: 1, 2, 5, 413, …, ; etc.
End. - Robert G. Wilson v, Aug 02 2014
LINKS
Pierre CAMI, Table of n, a(n) for n = 1..300
EXAMPLE
2*2^2-1=7 prime so a(1)=2.
3*2^3-1=23 prime so a(2)=2.
5*2^5-1=159 composite.
5*4^5-1=5119 prime so a(3)=4.
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 02 2014 *)
PROG
(PFGW & SCRIPT)
SCRIPT
DIM i, 0
DIM j
DIM n, -1
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+=2); k
vector(20, n, a(n)) \\ Colin Barker, Jul 27 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierre CAMI, Jul 27 2014
EXTENSIONS
Definition corrected by Colin Barker, Jul 27 2014
STATUS
approved