OFFSET
0,4
COMMENTS
Dedicated to my high school teachers Mr. Hochhaus and Mr. Bacharach.
LINKS
Agoura High School, Home Page
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