A239938 a(n) = least number k > 0 such that n*k^n - 1 is prime, or 0 if no such k exists.
3, 2, 1, 1, 4, 1, 8, 1, 40, 3, 10, 1, 56, 1, 10, 0, 46, 1, 6, 1, 42, 51, 4, 1, 8, 67, 0, 18, 102, 1, 98, 1, 38, 6, 136, 0, 90, 1, 10, 3, 52, 1, 12, 1, 18, 3, 28, 1, 72, 165, 40, 657, 418, 1, 44, 205, 94, 9, 426, 1, 482, 1, 4, 0, 418, 252, 38, 1, 400, 165, 28, 1, 140
Offset: 1
Keywords
Examples
1*1^1 - 1 = 0 is not prime. 1*2^1 - 1 = 1 is not prime. 1*3^1 - 1 = 2 is prime. Thus a(1) = 3.
Links
- Giovanni Resta, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
nope[n_] := n > 4 && Catch@Block[{p = 2}, While[n >= p^p, If[ IntegerQ[ n^(1/p)/p], Throw@ True]; p = NextPrime@ p]; False]; a[n_] := If[nope@ n, 0, Block[{k = 1}, While[! PrimeQ[n*k^n - 1], k++]; k]]; Array[a, 80] (* Giovanni Resta, Mar 30 2014 *) A239938[n_] := If[n != 4 && # != 1 && GCD[n, #] != 1 &[GCD @@ FactorInteger[n][[All, -1]]], 0, NestWhile[# + 1 &, 1, Not@PrimeQ[n #^n - 1] &]]; Array[A239938, 73] (* JungHwan Min, Dec 28 2015 *)
-
PARI
Pro(n) = for(k=1,10^4,if(ispseudoprime(n*k^n-1),return(k))); n=1; while(n<100,print1(Pro(n), ", ");n+=1)
Comments