OFFSET
1,2
COMMENTS
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
f:= proc(n) local m, k;
m:= (6*n + (-1)^n - 3)/2;
for k from 1 to ilcm(m, numtheory:-phi(m)) do
if igcd(k, m) = 1 and k &^ k - k - 1 mod m = 0 then return k fi;
od:
0
end proc:
map(f, [$1..100]); # Robert Israel, Sep 12 2017
MATHEMATICA
A007310[n_] := 2*n + 2*Floor[n/2] - 1; a[n_] := (For[m = A007310[n]; k = 1, k <= m^2, k++, If[PowerMod[k, k, m] == Mod[k+1, m], Return[k]]]; 0); Table[a[n], {n, 1, 75}] (* Jean-François Alcover, Sep 13 2013 *)
PROG
(PARI) a(n)=local(m); m=A007310(n); for(k=1, m^2, if(Mod(k, m)^k==k+1, return(k))); 0
CROSSREFS
KEYWORD
nonn
AUTHOR
Franklin T. Adams-Watters, Jun 17 2011
STATUS
approved