This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A140670 #24 Jul 30 2025 10:26:58 %S A140670 1,1,1,3,1,1,1,7,1,1,1,3,1,1,1,15,1,1,1,3,1,1,1,7,1,1,1,3,1,1,1,31,1, %T A140670 1,1,3,1,1,1,7,1,1,1,3,1,1,1,15,1,1,1,3,1,1,1,7,1,1,1,3,1,1,1,63,1,1, %U A140670 1,3,1,1,1,7,1,1,1,3,1,1,1,15,1,1,1,3,1,1,1,7,1,1,1,3,1,1,1,31,1,1,1,3,1,1 %N A140670 a(n) = 1 if n is odd; otherwise, a(n) = 2^k - 1 where 2^k is the largest power of 2 that divides n. %H A140670 Antti Karttunen, <a href="/A140670/b140670.txt">Table of n, a(n) for n = 1..16384</a> %F A140670 a(n) is multiplicative with a(2^e) = 2^e - 1 if e > 0, a(p^e) = 1 if p > 2. %F A140670 a(2*n + 1) = 1. a(-n) = a(n). a(2*n) = 2 * a(n) + (-1)^n unless n=0. %F A140670 Dirichlet g.f.: zeta(s)*(1+2^(1-2s)-2^(1-s))/(1-2^(1-s)). - _R. J. Mathar_, Feb 07 2011 %F A140670 a(n) = (2*A160467(n))-1. - _Antti Karttunen_, Nov 18 2017 %F A140670 Sum_{k=1..n} a(k) ~ (1/(2*log(2))) * (n*log(n) + (gamma + log(2)/2 - 1) * n), where gamma is Euler's constant (A001620). - _Amiram Eldar_, Oct 22 2022 %F A140670 a(n) = A006519(n) - A059841(n). - _Ridouane Oudra_, Jul 30 2025 %t A140670 a[n_] := If[OddQ[n], 1, 2^IntegerExponent[n, 2] - 1]; Array[a, 100] (* _Amiram Eldar_, Oct 22 2022 *) %o A140670 (PARI) {a(n) = if(n==0, 0, if(n%2, 1, 2^valuation(n, 2) - 1))} %o A140670 (Python) %o A140670 def A140670(n): return max(1,(n&-n)-1) # _Chai Wah Wu_, Jul 08 2022 %Y A140670 Cf. A001620, A006519, A135481, A160467, A059841, A330569. %K A140670 nonn,mult %O A140670 1,4 %A A140670 _Michael Somos_, May 21 2008