

Ask HN: A date conundrum - ErrantX

I heard this on the radio tonight but didnt catch the answer - it is bugging our whole house like crazy and we cant figure out the answer.... So. Help?<p>Question is: what is the next 8-digit date containing all <i>unique</i> numbers (i.e. no duplicates).<p>We came up with 17/06/2345 (UK format, 06/17/2345 in US format). But apparently that is wrong (we texted in and they listed us as "wrong")<p>Our logic is that the year 2345 is the <i>earliest</i> it can be because you need at least 2 out of 0, 1 or 2 to manage unique day/month combo's. As 2 is well wrapped up for the next 100 years 2345 is the first we can think of that gives us the 0 and 1 free). Am I wrong?<p>Any ideas?
======
profquail
I bet they said it's wrong because they are counting "06" as "6".

If you consider that each value (day/month/year) has to be at least 10, then
the month must be 10 or 12 (not 11, because of the duplicate "1").

Then, your day value must be somewhere in [23, 29] for October, or in [30] for
December.

After that, just look at the remaining 6 digits and order them in ascending
order.

Example: If you choose October (10), you could pick 27 as the day, which
leaves [3,6] U [8, 9] for the year digits, so you'd get 10/27/3456 (US
format).

EDIT: In fact, I think that example may be the best answer, because choosing a
day less than 27 makes the year value larger, so using 27, 28, or 29 should
minimize the year. Since you want the earliest date, 10/27/3456 should be it.

------
notaddicted
I am pretty sure you're right too, because I wrote a program to brute force
the calculation

<http://codepad.org/G9RLrsku>

------
ErrantX
Thanks everyone to reply - I guess the texter might have typed it wrong then
damn :D We literally spent hrs going "wtf...? it must be that"

Thanks for the sanity check

------
jibiki
Pretty sure you're right. Maybe you just texted in the wrong format or
something.

------
ars
4/5/2013 (Apr 5, 2013)

Are the days supposed to be two digits?

~~~
jibiki
"what is the next 8-digit date..."

~~~
ars
Then the submitter is correct.

