login
A298940
a(n) is the smallest positive integer k such that 3^n - 2 divides 3^(n + k) + 2, or 0 if there is no such k.
1
1, 3, 10, 39, 60, 121, 0, 117, 4920, 0, 0, 0, 28322, 0, 1434890, 0, 0, 0, 116226146, 0, 0, 15690529803, 0, 108443565, 66891206007, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22514195294549868, 0, 405255515301897626, 0, 1823649818858539320, 0, 0, 5861731560616733529, 0, 0, 0
OFFSET
1,2
COMMENTS
3^n - 2 divides 3^(n + (2m + 1) * a(n)) + 2 for all nonnegative integers m.
a(n) is the least positive integer k, if any, such that 3^k == -1 (mod 3^n-2). If the order of 3 mod p is odd for some prime p dividing 3^n-2, a(n)=0. - Robert Israel, Feb 05 2018
LINKS
EXAMPLE
a(2) = 3 because 3^2 - 2 divides 3^5 + 2 and 3^2 - 2 does not divide any 3^x - 2 for 2 < x < 5.
a(5) = 60 because 3^5 - 2 divides 3^65 + 2 and 3^5 - 2 does not divide any 3^x - 2 for 5 < x < 65.
MAPLE
# This requires Maple 2016 or later
f:= proc(n) local m, ps, a, p, q, phiq, v, br, ar;
m:= 3^n-2;
ps:= ifactors(m)[2];
a:= 0;
for p in ps do
q:= p[1]^p[2];
phiq:= (p[1]-1)*p[1]^(p[2]-1);
v:= NumberTheory:-MultiplicativeOrder(3, q);
if v::odd then return 0 fi;
if p[2]=1 then br:= v/2
else br:= traperror(NumberTheory:-ModularLog(-1, 3, q));
if br = lasterror then return 0 fi;
fi;
if a = 0 then a:= v; ar:= br
else
ar:= NumberTheory:-ChineseRemainder([ar, br], [a, v]);
if ar = FAIL then return 0 fi;
a:= ilcm(a, v);
fi
od:
ar;
end proc:
f(1):= 1:
map(f, [$1..50]); # Robert Israel, Feb 06 2018
MATHEMATICA
a[1] = 1; a[n_] := If[IntegerQ[order = MultiplicativeOrder[3, 3^n - 2, {-1}]], order, 0]; Table[an = a[n]; Print["a(", n, ") = ", an]; an, {n, 1, 20}] (* Jean-François Alcover, Feb 06 2018, after Robert Israel *)
PROG
(Python)
from sympy import discrete_log
def A298940(n):
if n == 1:
return 1
try:
return discrete_log(3**n-2, -1, 3)
except ValueError:
return 0 # Chai Wah Wu, Feb 05 2018
(PARI) a(n) = if(n==1, return(1)); my(l = znlog(-1, Mod(3, 3^n - 2))); if(l == [], return(0), return(l)) \\ Iain Fox, Feb 06 2018
CROSSREFS
Sequence in context: A140710 A103296 A259859 * A327847 A111749 A149048
KEYWORD
nonn
AUTHOR
Luke W. Richards, Jan 29 2018
EXTENSIONS
Corrected by Robert Israel, Feb 05 2018
STATUS
approved