in reply to Can you spot the problem?

(sorry... I had to run the code :P -- but in my own defense, I only had to run it a few times to see the pattern.)

No cigar for bmann, I'm afraid -- 192.168.0.0 thru 192.168.0.16 all pass, but 192.0.0.2 does not, nor does 192.20.0.0. (update: -- having seen bmann's update -- no, 192.168.255.255 will pass, but, e.g. 192.1.2.2 will fail.)

The key to the problem involves paying attention to the first digit in each quad, particularly in the cases where at least one quad has three digits and at least one other has fewer digits. It does make sense, and it's quite an amusing trap. Thanks.

(another update: different digit counts is not an essential property -- 100.100.100.200 also fails.)

Replies are listed 'Best First'.
Re: Re: Can you spot the problem?
by dws (Chancellor) on Mar 05, 2004 at 03:39 UTC
    So you ran the code and gave hints. Bad dog. No cookie for you.
Re: Re: Can you spot the problem?
by exussum0 (Vicar) on Mar 05, 2004 at 04:30 UTC
    You are partially right and partially wrong. You found a partial correlation between the two, but 213.244.213.213 will fail, but 213.243.213.213 will pass. And that's NOT using the first digit of every set. :)
      Thank you -- I did have a sense that I must have missed something (as I often do with puzzles like this). Now I don't feel so bad about not getting the cookie.
Re: Re: Can you spot the problem?
by bmann (Priest) on Mar 05, 2004 at 04:45 UTC
    Doh! Good thing I don't smoke cigars (very often)...

    Well, I'll console myself with the fact that I knew why the subroutine wouldn't work - I just chose a bad IP range trying to be cute ;) I overlooked one small detail<<<