login

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”).

a(n) = floor(frac(log_2(n))*n), where frac denotes the fractional part.
3

%I #24 Jan 04 2021 17:51:55

%S 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 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 42,45,47,49,52,54,56,59,61,0,1,2,4,5,7,9,10,12,13

%N a(n) = floor(frac(log_2(n))*n), where frac denotes the fractional part.

%H Chai Wah Wu, <a href="/A336018/b336018.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = floor((log_2(n) - floor(log_2(n)))*n).

%F From _Alois P. Heinz_, Jan 04 2021: (Start)

%F a(n) = A326299(n) - A340301(n).

%F a(n) = 0 <=> n in { A000079 }. (End)

%p a:= n-> floor(n*log[2](n))-n*ilog2(n):

%p seq(a(n), n=1..80); # _Alois P. Heinz_, Jan 04 2021

%t a[n_]:=Floor[FractionalPart[Log[2, n]]*n];

%t Table[a[n], {n, 1, 100}]

%o (PARI) a(n) = floor(n*frac(log(n)/log(2))); \\ _Michel Marcus_, Jul 07 2020

%o (Python)

%o def A336018(n):

%o return len(bin(n**n//(2**((len(bin(n))-3)*n))))-3 # _Chai Wah Wu_, Jul 09 2020

%Y Cf. A000079, A000523, A000195, A336017, A326299, A340301.

%K nonn

%O 1,6

%A _Andres Cicuttin_, Jul 04 2020