OFFSET
1,1
LINKS
Michel Marcus, Table of n, a(n) for n = 1..10000
EXAMPLE
a(10) = 79 = 10*2^3 - 1.
MAPLE
f:= proc(n) local m, k, p, x, xm, dm;
p:= 1; xm:= infinity;
if n::odd then dm:= 2 else dm:= 1 fi;
do
p:= nextprime(p);
if n*2^p-1 > xm then return xm fi;
if not irreduc(n*X^p-1) then next fi;
for m from 2 by dm do
x:= n*m^p-1;
if x > xm then break fi;
if isprime(x) then xm:= x; break fi;
od
od
end proc:
f(1):= 3:
map(f, [$1..100]); # Robert Israel, Feb 26 2018
MATHEMATICA
a[n_] := Module[{p, qq}, For[p = 2, True, p = NextPrime[p], qq = (p+1)/n; If[Denominator[qq] == 1 && GCD @@ FactorInteger[qq][[All, 2]] > 1, Return[p]]]];
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Feb 08 2023, after Michel Marcus *)
PROG
(PARI) a(n) = {forprime(p=2, , qq = (p+1)/n; if ((denominator(qq) == 1) && ispower(qq), return (p)); ); } \\ Michel Marcus, Feb 25 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Jun 19 2012
STATUS
approved