OFFSET
1,1
COMMENTS
3^n+2 divides 3^(n+a(n)*m)+2 for all nonnegative integers m.
Jon E. Schoenfield noted that a(n) coincides with the multiplicative order of 3 modulo 3^n+2. This is true because 3^(n+a(n)) == 3^n mod 3^n+2 and since 3^n and 3^n+2 are coprime, 3^a(n) == 1 mod 3^n+2 and the multiplicative order is the smallest positive such number. - Chai Wah Wu, Jan 29 2018
LINKS
Robert Israel, Table of n, a(n) for n = 1..175
EXAMPLE
For n = 1, f(1) = 3^1 + 2 = 5, where f(x) = 3^x + 2. Given the last digits of f(x) form a recurring sequence of 5, 1, 9, 3 [, 5, 1, 9, 3] then whenever x = 1 mod 4, f(x) will be a multiple of f(1).
For n = 2, f(2) = 3^2 + 2 = 11. a(2) = 5. So any x = 2 mod 5 will be a multiple of 11. For instance, 27 = 2 mod 5, and f(27) = 3^27 + 2 = 7625597474989 = 11 * 693236134999.
MAPLE
seq(numtheory:-order(3, 3^n+2), n=1..100); # Robert Israel, Feb 05 2018
MATHEMATICA
Array[Block[{k = 1}, While[! Divisible[3^(# + k) + 2, 3^# + 2], k++]; k] &, 12] (* Michael De Vlieger, Feb 05 2018 *)
Table[MultiplicativeOrder[3, 3^n + 2], {n, 32}] (* Jean-François Alcover, Feb 06 2018 *)
PROG
(Python)
def fmod(n, mod):
....return (pow(3, n, mod) + 2) % mod
def f(n):
....return pow(3, n) + 2
#terms is the number of terms to generate
terms = 20
for x in range(1, terms + 1):
....div = f(x)
....y = x + 1
....while fmod(y, div) != 0:
........y += 1
....print(y - x)
(Python)
from sympy import n_order
def A298827(n):
return n_order(3, 3**n+2) # Chai Wah Wu, Jan 29 2018
(Magma) [Modorder(3, 3^n+2): n in [1..29]]; // Jon E. Schoenfield, Jan 28 2018
(PARI) a(n) = znorder(Mod(3, 3^n+2)); \\ Michel Marcus, Jan 29 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Luke W. Richards, Jan 27 2018
EXTENSIONS
a(22)-a(32) from Robert Israel, Feb 05 2018
STATUS
approved