login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) = least number k > 0 such that n*k^n - 1 is prime, or 0 if no such k exists.
2

%I #20 Jan 25 2016 00:03:50

%S 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,

%T 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,

%U 44,205,94,9,426,1,482,1,4,0,418,252,38,1,400,165,28,1,140

%N a(n) = least number k > 0 such that n*k^n - 1 is prime, or 0 if no such k exists.

%C a(n) = 1 iff n-1 is prime.

%C If a(n) = 0 then n is in A097764. Note the converse is not true: a(4) = 1, not 0.

%C Up to a(1000), the largest term is a(456) = 947310. The PFGW program has been used to certify all the terms up to a(1000), using the 'N+1' deterministic test. - _Giovanni Resta_, Mar 30 2014

%H Giovanni Resta, <a href="/A239938/b239938.txt">Table of n, a(n) for n = 1..1000</a>

%e 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.

%t 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 *)

%t 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 *)

%o (PARI) Pro(n) = for(k=1,10^4,if(ispseudoprime(n*k^n-1),return(k)));

%o n=1; while(n<100,print1(Pro(n), ", ");n+=1)

%Y Cf. A066049, A097764, A239787.

%K nonn

%O 1,1

%A _Derek Orr_, Mar 29 2014