OFFSET
1,1
LINKS
Sandor Csörgö, Gordon Simons, On Steinhaus' resolution of the St. Petersburg paradox, Probab. Math. Statist. 14 (1993), 157--172. MR1321758 (96b:60017). See p. 163 and Table 1 p. 171.
FORMULA
a(n) = Sum_{k>=1} floor(n/2^k + 1/2)*2^k.
a(n) = 2 * A006520(n-1).
PROG
(PARI) a(n) = sum(k=1, 1+log(n)\log(2), floor(n/2^k+1/2)*2^k);
(Python)
def a(n):
s = 0
for k in range(1, n.bit_length()+1):
s += ((n + (1 << (k-1))) >> k) << k
return s
print([a(n) for n in range(1, 60)]) # Darío Clavijo, Aug 24 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Marcus, Oct 17 2019
STATUS
approved