login
a(n) = Sum_{k >= 1} floor(n * sqrt(2) / 2^k).
1

%I #11 Mar 20 2022 14:16:29

%S 0,1,3,3,4,7,7,8,10,11,11,15,16,16,18,19,22,22,23,25,25,26,31,31,32,

%T 34,35,35,38,39,39,41,42,46,46,47,49,49,50,53,53,54,56,57,57,63,64,64,

%U 66,67,70,70,71,73,73,74,78,79,79,81,82,82,85,86,86,88,89,94,94,95,97,97

%N a(n) = Sum_{k >= 1} floor(n * sqrt(2) / 2^k).

%C a(n) = A020965(n) - A005187(n).

%H Jon E. Schoenfield, <a href="/A155689/b155689.txt">Table of n, a(n) for n=1..1000</a>

%p a:=n->add(floor(n*sqrt(2)/2^k),k=1..2*n+2); seq(a(n),n=1..80); # _Muniru A Asiru_, Sep 28 2018

%t Table[Sum[Floor[n*Sqrt[2]/2^k], {k, 1, 2*n + 2}], {n, 1, 100}] (* _G. C. Greubel_, Sep 28 2018 *)

%o (PARI) for(n=1,100, print1(sum(k=1,2*n+2, floor(n*sqrt(2)/2^k)), ", ")) \\ _G. C. Greubel_, Sep 28 2018

%o (Magma) [(&+[Floor(n*Sqrt(2)/2^k): k in [1..2*(n+1)]]): n in [1..100]]; // _G. C. Greubel_, Sep 28 2018

%Y Cf. A005187, A020965.

%K nonn

%O 1,3

%A _Jon E. Schoenfield_, Jan 24 2009