|
|
A138575
|
|
Let H(1) = 0; B(0) = 0; H(n) = (n - B(n - 1)); B(n) = H(floor(n/2)); then a(n) = H(n) + B(n).
|
|
0
|
|
|
1, 1, 1, 3, 5, 5, 8, 7, 9, 9, 10, 11, 13, 13, 13, 15, 17, 17, 18, 19, 21, 21, 23, 23, 25, 25, 26, 27, 29, 29
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,4
|
|
COMMENTS
|
Dedicated to my high school teachers Mr. Hochhaus and Mr. Bacharach.
|
|
LINKS
|
|
|
EXAMPLE
|
H(4) = 4 - B(3);
B(3) = 3 / 2 = 1
H(4) = 4 - 1 = 3.
B(4) = 4 / 2 = 2.
Therefore a(4) = H(4) + B(4) = 3 + 2 = 5.
|
|
PROG
|
(Java)
static int Hochhaus(int n)
{
if (n < 0) return -1;
if (n == 1) return 0;
else return (n - Bacharach(n - 1));
}
static int Bacharach(int n)
{
if (n < 0) return -1;
if (n == 0) return 0;
else return (Hochhaus(n/2));
}
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
Andrew Bloom (ambloom_2006(AT)yahoo.com), May 12 2008
|
|
STATUS
|
approved
|
|
|
|