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 A336018 #24 Jan 04 2021 17:51:55 %S A336018 0,0,1,0,1,3,5,0,1,3,5,7,9,11,13,0,1,3,4,6,8,10,12,14,16,18,20,22,24, %T A336018 27,29,0,1,2,4,6,7,9,11,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40, %U A336018 42,45,47,49,52,54,56,59,61,0,1,2,4,5,7,9,10,12,13 %N A336018 a(n) = floor(frac(log_2(n))*n), where frac denotes the fractional part. %H A336018 Chai Wah Wu, <a href="/A336018/b336018.txt">Table of n, a(n) for n = 1..10000</a> %F A336018 a(n) = floor((log_2(n) - floor(log_2(n)))*n). %F A336018 From _Alois P. Heinz_, Jan 04 2021: (Start) %F A336018 a(n) = A326299(n) - A340301(n). %F A336018 a(n) = 0 <=> n in { A000079 }. (End) %p A336018 a:= n-> floor(n*log[2](n))-n*ilog2(n): %p A336018 seq(a(n), n=1..80); # _Alois P. Heinz_, Jan 04 2021 %t A336018 a[n_]:=Floor[FractionalPart[Log[2, n]]*n]; %t A336018 Table[a[n], {n, 1, 100}] %o A336018 (PARI) a(n) = floor(n*frac(log(n)/log(2))); \\ _Michel Marcus_, Jul 07 2020 %o A336018 (Python) %o A336018 def A336018(n): %o A336018 return len(bin(n**n//(2**((len(bin(n))-3)*n))))-3 # _Chai Wah Wu_, Jul 09 2020 %Y A336018 Cf. A000079, A000523, A000195, A336017, A326299, A340301. %K A336018 nonn %O A336018 1,6 %A A336018 _Andres Cicuttin_, Jul 04 2020