Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #31 Apr 15 2020 02:24:07
%S 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,
%T 28,3,5,13,57,23,6,9,36,23,12,37,40,15,17,29,63,63,35,45,6,23,27,17,
%U 19,27,57,109,18,31,10,57,52,5,90,45,17,57,66,65,63,23,70
%N a(n) is the smallest positive number k such that n divides 3^k + k.
%C For any positive integer n, if k = a(n) + n*m*A007734(n) and m >= 0 then 3^k + k is divisible by n.
%H Seiichi Manyama, <a href="/A333334/b333334.txt">Table of n, a(n) for n = 1..5000</a>
%H Brazil National Olympiad, 2005, <a href="https://artofproblemsolving.com/community/c6h57713">Problem 6</a>
%F a(3^m) = 3^m for m >= 0.
%F a(p) <= p - 1 if p is a prime greater than 3.
%t a[n_] := Module[{k = 1}, While[!Divisible[3^k + k, n], k++]; k]; Array[a, 100] (* _Amiram Eldar_, Mar 16 2020 *)
%o (PARI) a(n) = for(k=1, oo, if(Mod(3, n)^k==-k, return(k)));
%Y Cf. A007734, A247248, A333335, A333336, A333339.
%K nonn,easy
%O 1,3
%A _Jinyuan Wang_, Mar 15 2020