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
Seiichi Manyama, Table of n, a(n) for n = 1..5000
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