For Neopets ONLY discussion.
Wed Feb 28, 2007 11:16 pm
In an exceptionally long corridor in the Virtupets Space Station, there are one thousand windows along one wall. Coincidentally, there are exactly one thousand Grundos in the station. Dr Sloth orders the first Grundo to open the blinds on every window. Then, he orders the second Grundo to close the blinds on every second window. Then the third Grundo is told to go to every third window, and close the blinds if they are open, and open the blinds if they are closed. The fourth Grundo does this for every fourth window, and so on.
After all 1000 Grundos complete the process, how many blinds are open?
I feel really proud of myself because I programmed the solution to this in Java. I hope I did it right, though.
My answer was a prime number.
Thu Mar 01, 2007 12:16 am
HEY, I DELETE IT MYSELF AS I MISCOUNTED ANYWAY SO CAN'T WIN.
Thu Mar 01, 2007 3:35 am
That's probably far too big of a hint. That's almost the whole way there.
Just in case that post does end up deleted, here's a replacement Hint: Instead of thinking about the doors that are visited by a specific Grundo, consider which Grundos visit a specific door.
My reasoning pretty much matches eagle_in_your_mind's, but my answer is prime too. Rounding error?
One might think that there is also a slight ambiguity - I assumed that "every second" starts at the second window, but "every second" could start at the first. The ambiguity doesn't have as much impact as one would expect. It would have more impact if there were 999 doors - I'll leave the reasoning open.
I've seen this puzzle before. The conundrums lately seem awfully bottled, to be honest.
Last edited by
AySz88 on Thu Mar 01, 2007 4:15 am, edited 1 time in total.
Thu Mar 01, 2007 4:02 am
Oops I missed one out. Once I knew the type of number I googled a list of them to save time. The list is missing one of the numbers.
Thu Mar 01, 2007 4:14 am
eagle_in_your_mind wrote:HEY, I DELETE IT MYSELF AS I MISCOUNTED ANYWAY SO CAN'T WIN.

Sorry.

You can hold onto it and post it as a solution after it's judged, maybe.
Thu Mar 01, 2007 7:56 am
Err... that one's just a rendition of a pretty common mathematical problem.
There should be at least one circulating around the web somewhere...since I remember seeing one.
and...yeah...its definitely a prime number...the clue is in factors....
Thu Mar 01, 2007 11:31 am
theonlysaneone wrote:In an exceptionally long corridor in the Virtupets Space Station, there are one thousand windows along one wall. Coincidentally, there are exactly one thousand Grundos in the station. Dr Sloth orders the first Grundo to open the blinds on every window. Then, he orders the second Grundo to close the blinds on every second window. Then the third Grundo is told to go to every third window, and close the blinds if they are open, and open the blinds if they are closed. The fourth Grundo does this for every fourth window, and so on.
I feel really proud of myself because I programmed the solution to this in Java. I hope I did it right, though.
My answer was a prime number.
Is there a question included there somewhere?
Thu Mar 01, 2007 8:16 pm
Kenjiro wrote:Is there a question included there somewhere?
"
After all 1000 Grundos complete the process, how many blinds are open?"
Thu Mar 01, 2007 10:52 pm
AySz88 wrote:Kenjiro wrote:Is there a question included there somewhere?
"
After all 1000 Grundos complete the process, how many blinds are open?"
I totally didn't realize the question wasn't there...It has been edited in now!
Wed Mar 07, 2007 11:07 pm
Hmm...oh yeah, what basically happens here is that:
The 1st grundo will reach the blinds that are multiples of 1. [all]
2nd -> multiples of 2
3rd -> multiples of 3
etc.
i.e., if we focus on the windows:
The 1st window will be reached by the 1st grundo
2nd window -> 1st and 2nd grundo
3rd window -> 1st and 3rd grundo
4th window -> 1st, 2nd and 4th grundo
etc.
Thus, what we are actually interested in, is the number of factors each number has.
If the no. is odd, then the blinds would be opened,
if it's even, then the blinds would be closed.
Factors
Since factors come in pairs. The only numbers that 'have an odd no. of factors' are square numbers.
e.g.
4 = 1*4 = 2*2.
Factors of 4 = 1, 2, 4 [odd]
Blinds that are open
Hence, the 1st blind that's open will be the very first blind, and 1 can be expresses as 1*1.
2nd -> 4th blind -> 2*2
3rd -> 9th blind -> 3*3
4th -> 16th blind -> 4*4
Actual calculation
In other words, all we need to do, is to find the square number that is closest to 1000, without exceeding it. Alternatively, you could just find the square root of 1000 [31.623...], and round it down [31].
Anyway, the answer's 31, which is a prime no.
Wed Mar 07, 2007 11:24 pm
I actually wrote a program in Java for this:
- Code:
public class WindowCounter
{
public static void main(String[] args)
{
int[] windows = new int[1001];
int counter=0;
for(int x=1; x<=1000; x++)
{
for(int y=1; y<=1000; y++)
{
if(y%x==0)
{
if(windows[y]==0)
windows[y]=1;
else
windows[y]=0;
}
}
}
for(int z=1; z<=1000; z++)
{
if(windows[z]==1)
{
counter++;
}
}
System.out.println(counter);
}
}
There was probably an easier way to do it, but whatever. I placed.
Thu Mar 08, 2007 8:54 am
theonlysaneone wrote:- Code:
if(windows[y]==0)
windows[y]=1;
else
windows[y]=0;
For variables switching constantly from 1 to 0, etc. you could always change it to "var = 1 - var;". ...saves space at the cost of readability...
Powered by phpBB © phpBB Group.
phpBB Mobile / SEO by Artodia.