Monday morning math puzzle
Feb. 28th, 2005 07:29 amIt's Monday morning, time to re-engage those sluggish little neurons. Here's a cute math problem someone walked into my office with last Friday:
How many numbers N between 1 and 2005, inclusive, can be expressed in the form
floor(x * floor(x)) = N
where x can be any real number?
For those not familiar with "floor", it means take the first integer that's less than or equal to x. So the floor of 2.0 is 2, the floor of 3.5 is 3, the floor of -1.9 is -2. So, to get you started, N is definitely always an integer.
If you think you know the answer and it's been less than 60 seconds, you probably think the answer is "the perfect squares". You are wrong, or rather, your answer is incomplete. Try again. :)
To make this interesting, the first person to respond with the right answer gets to choose between the following prizes: a physical box of cookies mailed to your doorstep (you get to express a preference but I'll pick the cookies), or the right to define an icon which I will use for 10 non-private posts in a row immediately following your posting of that icon in a comment.
Edit: blue has pointed out there's an ambiguity in the problem, so I changed it from '0 to 2005' to '1 to 2005, inclusive'.
Edit: And J has pointed out that I had a REALLY bad typo... + versus *. MOTHERFUCKER! I have no idea how that happened. :( I reread this several times to make sure it was right and... it wasn't. I'm really sorry. Anyone game for trying again? I'll delete all the comments.
How many numbers N between 1 and 2005, inclusive, can be expressed in the form
floor(x * floor(x)) = N
where x can be any real number?
For those not familiar with "floor", it means take the first integer that's less than or equal to x. So the floor of 2.0 is 2, the floor of 3.5 is 3, the floor of -1.9 is -2. So, to get you started, N is definitely always an integer.
If you think you know the answer and it's been less than 60 seconds, you probably think the answer is "the perfect squares". You are wrong, or rather, your answer is incomplete. Try again. :)
To make this interesting, the first person to respond with the right answer gets to choose between the following prizes: a physical box of cookies mailed to your doorstep (you get to express a preference but I'll pick the cookies), or the right to define an icon which I will use for 10 non-private posts in a row immediately following your posting of that icon in a comment.
Edit: blue has pointed out there's an ambiguity in the problem, so I changed it from '0 to 2005' to '1 to 2005, inclusive'.
Edit: And J has pointed out that I had a REALLY bad typo... + versus *. MOTHERFUCKER! I have no idea how that happened. :( I reread this several times to make sure it was right and... it wasn't. I'm really sorry. Anyone game for trying again? I'll delete all the comments.
what's precision got to do with it?
Date: 2005-02-28 10:21 am (UTC)is cheatingbetrays an initial lack of understanding of the underlying number theory.why do you say that? If you're gonna go with a brute force method... how better to cover the reals? Plus, for such a limited range, it took less than a minute. Not to mention, I had the program already written for the '+' version of the problem, since analytically I came to the same conclusion as everyone else, and you said it was wrong. So, I never tried to understand it in a number theory sense. Only one character change was necessary.