login
A333334
a(n) is the smallest positive number k such that n divides 3^k + k.
4
1, 1, 3, 1, 3, 3, 6, 5, 9, 3, 2, 9, 10, 15, 3, 13, 4, 9, 18, 17, 6, 29, 22, 21, 23, 17, 27, 25, 28, 3, 5, 13, 57, 23, 6, 9, 36, 23, 12, 37, 40, 15, 17, 29, 63, 63, 35, 45, 6, 23, 27, 17, 19, 27, 57, 109, 18, 31, 10, 57, 52, 5, 90, 45, 17, 57, 66, 65, 63, 23, 70
OFFSET
1,3
COMMENTS
For any positive integer n, if k = a(n) + n*m*A007734(n) and m >= 0 then 3^k + k is divisible by n.
LINKS
Brazil National Olympiad, 2005, Problem 6
FORMULA
a(3^m) = 3^m for m >= 0.
a(p) <= p - 1 if p is a prime greater than 3.
MATHEMATICA
a[n_] := Module[{k = 1}, While[!Divisible[3^k + k, n], k++]; k]; Array[a, 100] (* Amiram Eldar, Mar 16 2020 *)
PROG
(PARI) a(n) = for(k=1, oo, if(Mod(3, n)^k==-k, return(k)));
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jinyuan Wang, Mar 15 2020
STATUS
approved