OFFSET
1,1
COMMENTS
a(2) is -1, because 3^n-1 cannot be divisible by prime(2)=3.
For some terms, prime(n)^2 is also the least square of prime which divides 3^a(n)-1. This is the case for n=1, 5, 6, ..., that is, p=2, 11, 13, ... (see A283454).
prime(n)*A062117(n) if not. - Robert Israel, Mar 16 2017
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000 (first 100 terms from Anton Mosunov)
MAPLE
subs(FAIL=-1, [seq(numtheory:-order(3, ithprime(i)^2), i=1..100)]); # Robert Israel, Mar 16 2017
MATHEMATICA
Join[{2, -1}, Table[Module[{k=1}, While[PowerMod[3, k, Prime[n]^2]!=1, k++]; k], {n, 3, 50}]] (* Harvey P. Dale, Oct 22 2023 *)
PROG
(PARI) a(n) = if (n == 2, -1, k = 1; p = prime(n); while((3^k-1) % p^2, k++); k; );
CROSSREFS
KEYWORD
sign,look
AUTHOR
Michel Marcus, Mar 12 2017
STATUS
approved