Author |
Topic: binary (Read 870 times) |
|
mad
Junior Member
Posts: 118
|
Let f(k) = y where k is the y-th number in the increasing sequence of non-negative integers with the same number of ones in its binary representation as y, e.g. f(0) = 1, f(1) = 1, f(2) = 2, f(3) = 1, f(4) = 3, f(5) = 2, f(6) = 3 and so on. Given k >= 0, compute f(k).
|
|
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: binary
« Reply #1 on: Jul 31st, 2007, 2:26pm » |
Quote Modify
|
I can't entirely understand the way you've phrased that.. Is f(k) an inverse function, because it seems k depends on y rather than vice versa.
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
Eigenray
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 1948
|
|
Re: binary
« Reply #2 on: Jul 31st, 2007, 2:55pm » |
Quote Modify
|
It's basically the "prime bits" problem. Except not necessarily prime. (Inverse problem here and here.)
|
« Last Edit: Jul 31st, 2007, 2:57pm by Eigenray » |
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: binary
« Reply #3 on: Jul 31st, 2007, 3:03pm » |
Quote Modify
|
Ah, f(k) is the count of nonnegative numbers k with the same number of bits set to one as k. Now I understand it.
|
« Last Edit: Jul 31st, 2007, 3:04pm by towr » |
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
mad
Junior Member
Posts: 118
|
|
Re: binary
« Reply #4 on: Jul 31st, 2007, 3:31pm » |
Quote Modify
|
Eg. 1010 will come after 0011 0101 0110 1001 1010 So, it is the 5th number here.
|
|
IP Logged |
|
|
|
|