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

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
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
Sequence in context: A197286 A019632 A021285 * A263209 A101330 A063285
KEYWORD
nonn
AUTHOR
Andrew Bloom (ambloom_2006(AT)yahoo.com), May 12 2008
STATUS
approved