When I originally posed Challenge #12, a certain Dave posted a series of comments with some explorations and partial solutions to part II (the hyperbinary sequence). Although I gave the “solution” in my last post, no solution to any problem is ever the last word—there’s always more to explore, more connections to see! It’s worth taking another post to explore some of Dave’s discoveries and conjectures, and how they connect to my last post. I’ve used different notations, made up some terms, tried to simplify things where possible, and so on, but all the ideas in this post are fundamentally Dave’s.
First things first
Dave first noticed that
for all . I noted this in my previous post as well, but said only that this is “apparent” from thinking about the recursive construction I described. However, it’s worth going through a proof of this more formally; it’s a good example of a proof by induction. First, let’s recall the recurrence relation that defines the hyperbinary sequence:
Now we can show that for . First, the base case: when , ; check!
Now, let’s suppose that for some particular ; this is called the inductive hypothesis, which I will abbreviate as IH. we want to show that as well. is obviously odd, so we want to apply rule (O). The only trick is to get it into the right form first:
Presto! Since the thing we wanted to show is true when and is true for whenever it is true for , by induction it must be true for all .
Second things, third things…
But Dave then went on to notice that this sort of pattern isn’t unique to 1. For example,
for , and
also for . Dave conjectured that this generalizes, and indeed it does: most generally, we can say that
for . That is, once a certain number occurs at position , it will keep occurring in a regular pattern after that, at every position of the form . Note that is a special case with .
Why is this? Intuitively, it’s because of the “copying”—the blue numbers in my previous post. Once a number occurs, it will keep getting copied, but with the distance between the copies doubling each time. But again, this is worth proving formally. I’ll let you do this one—the proof by induction is similar to the proof above!
But why do occurrences of 1 correspond to , and occurrences of 2 to , and occurrences of 3 to and , and so on? Are there any patterns to be found here? This is what Dave explored next; let’s follow.
Primary occurrences and the inverse of h
Let’s think a little more about this equation . Let’s suppose that is odd (if it isn’t, we can always take another factor of two out of it to combine with the ). Notice that is always odd, except when (in which case , which is even). Moreover, we can always write any odd number in the form , where is odd: just add one, and factor out as many copies of 2 as possible. For example, .
This means that if is any odd number, we can write it in the form , and so : that is, every odd position in the hyperbinary sequence is just copied from an earlier even position. Of course, this can also be seen from the recursive construction in my previous post; but now we have really proved it! And what about the even positions? The values of the hyperbinary sequence at even positions are obtained by adding, rather than copying. If occurs at an even position, we will call it a primary occurrence of .
The nice thing about primary occurrences is that (a) there are only finitely many primary occurrences of any particular (challenge: prove this!), and (b) once we know the positions of the primary occurrences of , we know the positions of all the occurrences of : they are at positions of the form , where is a primary occurrence.
So, given , can we find all its primary occurrences? Essentially we are asking if we can compute (by which I mean the inverse relation of ; since is not injective its inverse is obviously not a function), but leaving out non-primary occurrences since we can easily find those from primary ones. Let’s start by making a table with some small values of :
|5||10, 12, 16, 30|
|7||18, 22, 24, 28, 64, 126|
|8||20, 26, 128, 254|
|9||34, 46, 48, 60, 256, 510|
|10||38, 56, 512, 1022|
|11||36, 40, 54, 58, 66, 94, 96, 124, 1024, 2046|
|12||44, 50, 2048, 4094|
|13||42, 52, 70, 78, 112, 120, 130, 190, 192, 252, 4096, 8190|
|14||68, 80, 110, 122, 8192, 16382|
|15||72, 118, 258, 382, 384, 508, 16384, 32766|
|16||92, 98, 134, 158, 224, 248, 32768, 65534|
Do you see any patterns? If so, can you prove them by induction? I’ll talk about a few in my next post. But I still don’t know whether there’s an effective way to compute !
I’m still thinking about how to find those “primary occurrences” (great way of phrasing that, by the way). I certainly prefer reading your interpretations of my solutions to my own jumbled mess of ideas. I always learn a great deal about notation from your site. I found the same thing when you interpreted my solution to the “cookie problem.” Thanks again and please keep up the great work.
Great, let me know if you have any good ideas about finding primary occurrences! (I actually suspect—just a gut feeling—that the general problem is rather difficult, but don’t let that dissuade you. =) And I’m very glad to hear that you appreciate my interpretation–I take great joy in understanding other people’s good ideas and then re-presenting them in ways that are as clear and widely accessible as possible.
In the table, the number of primary occurrences of N seems to be euler-phi(N). I wish I had any time to figure out why but I don’t.
great series…got pointed here by a post over at division by zero which mentioned that great calkin-wilf tree. i came at this problem from a binary representation perspective, counting when a 10 could be represented as (01 + 01), which then opens up a new slot for any higher digits…. i was sad to see jason had worked out most of the details over a year ago, but i’ll keep working on it.
that said, it does suggest how to construct the largest primary occurrence of n. if you take a sequence of 1s (2^k – 1), there is one way to represent that number. however, if you set the last digit to 0 (2^k – 2), you now have choices (and you’ve made an even number). 2^1 can be represented as 2^0+2^0. and now, since there are no longer any 2^1s, 2^2 can be represented as 2^1+2^1, and so on. you end up with an alternative representation for each digit, plus the original representation, or k representations.
h(2^n – 2)=n
for n=1, h(2-2)=h(0)=1
h(2^(n+1) – 2)=h(2^n – 1)+h(2^n – 2)=1+n
i say this is the largest primary occurrence because, intuitively, adding any digits (except leading 0s) will either add “choices” or make the number odd. i’ve already stayed up too late already, however, so i’ll have to leave the proof for later. the glaring 4,8,16,32,64,128…pattern in the chart above for the second largest occurrences will also have to wait until tomorrow.
just kidding, that’s the second easiest representation, a 1 followed by k-1 0s.
for k=0, h(2^0)=h(1)=h(0)=1
h(2^(k+1))=h(2^k)+h(2^k – 1)=(k+1)+1=k+2
so, for n=10, 2^9=512; n=11, 2^10=1024, etc.
harder to prove that this one is the “second largest primary occurrence,” though.
Fergal: By golly, you’re right! I hadn’t noticed that. Hopefully someone will be able to prove it.
Brendan: good work! Indeed, those are the largest and second largest primary occurrences—which you can see intuitively by thinking about the recursive construction method I explained in a previous post. Proving it formally should not be too bad, I think, if you use the intuition to guide you—I think the hardest part would just be figuring out the correct (and sufficiently strong) inductive hypotheses.
the inverse relation is probably well beyond my number theory ability, but i’m enjoying playing with some of these easier patterns.
to generalize my findings above, i thought i’d show a closed form of h for binary numbers made by a string of p 1s and then q 0s (eg for 1110000 p=3, q=4). formatting in these comments makes it a little hard to follow, but hopefully this is clear. i also haven’t done an induction proof with two variables in a lot of years, but i think i have this right. the following depends on
h(2^n – 2)=n
h(p*2^k – 1) = h(p-1)
h(2^(p+q) – 2^q) = 1+pq
the base case would just be h(2^k -1), where q is 0 and p=k
h(2^(p+q+1) – 2^(q+1))=h(2^(p+q) – 2^q)+h(2^(p+q) – 2^q – 1)
the first term is assumption, so is equal to 1+pq, the second term:
h(2^(p+q) – 2^q – 1)=h((2^p)(2^q) – 2^q – 1)=h((2^p – 1)(2^q) – 1)
=h((2^p – 1) – 1)=h(2^p – 2)=p
summing the two terms
h(2^(p+(q+1)) – 2^(q+1))=1+pq+p=1+(q+1)p
looking at this now, would i need to hold q constant now and show the same for p+1?
the most interesting result of this (to me) is that this sets a lower limit for the number of primary occurrences of n as the number of divisors (including 1) of (n-1). for instance, n=13: 12 has 6 divisors and 6 of 13’s primary occurrences do indeed happen at numbers with binary representations of p 1s and q 0s where p*q=12. it also means that there are only two primary occurrences of this form for primes+1.
hopefully these aren’t blatantly obvious results!
Brendan: Very cool! Glad you’re having fun. =) This is definitely not blatantly obvious, and it looks good. Re: your proof, you actually don’t need to go back and hold q constant and show it for p+1; the reason is that your base case holds for any value of p. If you only had a base case for p=0 and q=0 then you would have to do the induction for p as well.
Pingback: Hyperbinary conjecture seeking proof for a good time, long walks on the beach « The Math Less Traveled
Pingback: The hyperbinary sequence and the Calkin-Wilf tree « The Math Less Traveled
Pingback: Hyperbinary numbers and amateur-hour number theory « An Extremely Satisfactory Totalitarianism
Pingback: The hyperbinary sequence and the Calkin-Wilf tree | The Math Less Traveled