Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #31 Dec 27 2022 02:28:47
%S 1,0,2,0,1,0,1,0,3,0,1,0,1,0,2,0,1,0,1,0,2,0,1,0,1,0,4,0,1,0,1,0,2,0,
%T 1,0,1,0,2,0,1,0,1,0,3,0,1,0,1,0,2,0,1,0,1,0,2,0,1,0,1,0,3,0,1,0,1,0,
%U 2,0,1,0,1,0,2,0,1,0,1,0,5,0,1,0,1,0,2
%N Exponent of 3 in 2^n + 1.
%C Records: a(3^(n-1)) = n and a(k) < n for k < 3^(n-1).
%C Multiplicative because A051064 is. - _Andrew Howroyd_, Jul 28 2018
%H Amiram Eldar, <a href="/A284413/b284413.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from Indranil Ghosh)
%F a(n) = A051064(n) if n is odd, 0 otherwise.
%F Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 3/2. - _Amiram Eldar_, Sep 11 2020
%F From _Amiram Eldar_, Dec 27 2022: (Start)
%F Multiplicative with a(2^e) = 0, a(3^e) = e+1, and a(p^e) = 1 if p >= 5.
%F Dirichlet g.f.: zeta(s)*(1-1/2^s)/(1-1/3^s). (End)
%e a(27) = 4 because 2^27 + 1 = 134217729 = 3^4 * 19 * 87211.
%t Table[If[OddQ[n], IntegerExponent[3n, 3], 0], {n, 100}] (* _Indranil Ghosh_, Mar 27 2017 *)
%o (Magma) [IsEven(n) select 0 else Factorization(3*n)[1][2]: n in [1..87]];
%o (PARI) a(n) = if(n%2, if(n<1, 0, 1 + valuation(n, 3)), 0); \\ _Indranil Ghosh_, Mar 27 2017
%Y Cf. A051064, A168570 (exponent of 3 in 2^n - 1).
%K nonn,mult,easy
%O 1,3
%A _Jon E. Schoenfield_, Mar 26 2017