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 #15 Mar 19 2020 11:21:38
%S 1,1,3,3,7,3,2,3,9,7,4,3,16,5,27,11,5,9,29,7,27,45,39,3,73,27,27,27,
%T 22,27,132,27,36,5,27,27,65,29,27,27,27,27,10,59,27,39,12,27,47,73,42,
%U 27,68,27,36,27,30,47,154,27,192,147,27,59,16,45,119,75,39
%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.
%C a(n) > log_3(n). - _Robert Israel_, Mar 19 2020
%H Robert Israel, <a href="/A333339/b333339.txt">Table of n, a(n) for n = 1..10000</a>
%F a(3^m) = 3^m for m >= 0.
%F a(3^m-m) = m for m >= 1. - _Robert Israel_, Mar 19 2020
%p f:= proc(n) local k;
%p for k from 1 do if 3 &^k - k mod n = 0 then return k fi od
%p end proc:
%p map(f, [$1..100]); # _Robert Israel_, Mar 19 2020
%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, A072872, A333334.
%K nonn
%O 1,3
%A _Jinyuan Wang_, Mar 16 2020