A104117 For n=2^k, a(n) = k+1, else 0.
1, 2, 0, 3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1
Examples
a(8) = 4 = sum of row 8 terms of A103994: (1 + 1 + 0 + 1 + 0 + 0 + 0 + 1). a(8) = 4 = 1 + log_2(8).
Programs
-
Mathematica
a[n_] := Module[{e = IntegerExponent[n, 2]}, If[n == 2^e, e+1, 0]]; Array[a, 100] (* Amiram Eldar, Aug 31 2023 *)
-
PARI
a(n)=direuler(p=1,n,if(p==2,1/(1-X)^2,1))[n] /* Ralf Stephan, Mar 28 2015 */
-
PARI
a(n)=if(n==2^valuation(n,2),valuation(n,2)+1,0) /* Ralf Stephan, Mar 28 2015 */
Formula
a(n) = 1 + log_2(n), for n = 1, 2, 4, 8, ... and the rest zeros.
Dirichlet g.f.: 1/(1-2^(-s))^2, i.e., Dirichlet convolution of A036987 (right-shifted, assuming offset 1 there) with itself.
Multiplicative with a(2^e) = 1+e, and a(p^e) = 0 for odd primes p and e>=1. Dirichlet convolution square of A209229. - R. J. Mathar, Mar 12 2012
Extensions
More terms and better name from Ralf Stephan, Mar 28 2015
Comments