login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

A054248
Binary entropy: a(n) = n + min { a(k)+a(n-k) : 1 <= k <= n-1 }.
4
1, 2, 6, 8, 13, 16, 21, 24, 30, 34, 40, 44, 50, 54, 60, 64, 71, 76, 83, 88, 95, 100, 107, 112, 119, 124, 131, 136, 143, 148, 155, 160, 168, 174, 182, 188, 196, 202, 210, 216, 224, 230, 238, 244, 252, 258, 266, 272, 280, 286, 294, 300, 308, 314, 322, 328, 336
OFFSET
1,2
REFERENCES
D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 3, p. 374.
LINKS
Hsien-Kuei Hwang, S. Janson, and T.-H. Tsai, Exact and Asymptotic Solutions of a Divide-and-Conquer Recurrence Dividing at Half: Theory and Applications, ACM Transactions on Algorithms, 13:4 (2017), #47; DOI: 10.1145/3127585.
FORMULA
a(n) = A123753(n-1) - (n-1) mod 2. - Peter Luschny, Nov 30 2017
MAPLE
A054248 := proc(n) local i, j; option remember; if n<=2 then n else j := 10^10; for i from 1 to n-1 do if A054248(i)+A054248(n-i) < j then j := A054248(i)+A054248(n-i); fi; od; n+j; fi; end;
# second Maple program:
a:= proc(n) option remember; `if`(n<3, n,
n + min(seq(a(k)+a(n-k), k=1..n/2)))
end:
seq(a(n), n=1..80); # Alois P. Heinz, Aug 29 2015
MATHEMATICA
a[n_] := n + n IntegerLength[n, 2] - 2^IntegerLength[n, 2] + Mod[n, 2];
Table[a[n], {n, 1, 54}] (* Peter Luschny, Dec 02 2017 *)
PROG
(Python)
def A054248(n):
s, i, z = n - (n-1) % 2, n-1, 1
while 0 <= i: s += i; i -= z; z += z
return s
print([A054248(n) for n in range(1, 55)]) # Peter Luschny, Nov 30 2017
(Python)
def A054248(n): return n*(1+(m:=(n-1).bit_length()))-(1<<m)+(n&1) # Chai Wah Wu, Mar 29 2023
CROSSREFS
Sequence in context: A168247 A229056 A186703 * A038108 A356217 A294862
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, May 04 2000
STATUS
approved

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy