8
$\begingroup$

I´ve forgotten my PIN, a four-digit number. All I remember is that it is a perfect square, and that it has at least one digit in common with every other four-digit square number. What is it?

$\endgroup$
1
  • $\begingroup$ (Of course you're free to choose which answer to accept, based on whatever criteria makes most sense to you, but in general the choice between two essentially equivalent answers most commonly goes to the earliest posting. If that was your intent, I will confirm that Beastly Gerbil's answer was earlier than the currently accepted post, by 38 seconds.) $\endgroup$
    – Rubio
    Jan 1, 2018 at 21:11

3 Answers 3

5
$\begingroup$

Answer:

6241

It has at least 1 digit common with every 4 digit complete squares given below

1024, 1089, 1156, 1225, 1296, 1369, 1444, 1521, 1600, 1681, 1764, 1849, 1936, 2025, 2116, 2209, 2304, 2401, 2500, 2601, 2704, 2809, 2916, 3025, 3136, 3249, 3364, 3481, 3600, 3721, 3844, 3969, 4096, 4225, 4356, 4489, 4624, 4761, 4900, 5041, 5184, 5329, 5476, 5625, 5776, 5929, 6084, 6241, 6400, 6561, 6724, 6889, 7056, 7225, 7396, 7569, 7744, 7921, 8100, 8281, 8464, 8649, 8836, 9025, 9216, 9409, 9604, 9801

How I found it.

I checked which digits are most frequently occurred in all of them, which were 1, 2, 4, and 6. Now I found any number from all of them which I found as 6241

$\endgroup$
11
  • $\begingroup$ Sorry just beat you to it :) $\endgroup$ Dec 31, 2017 at 13:27
  • $\begingroup$ I thought I'm first. :/ $\endgroup$ Dec 31, 2017 at 13:29
  • $\begingroup$ I think it should also show the minutes and seconds. $\endgroup$ Dec 31, 2017 at 13:31
  • 4
    $\begingroup$ For what it's worth, you can get the timestamp of a post with in Universal time by hovering over the time. That time is accurate to the second. $\endgroup$
    – M Oehm
    Dec 31, 2017 at 14:21
  • 1
    $\begingroup$ @Bass: I guess you don't keep your finger or your phone still enough. Apparently all the lawyers who work on the "I was first!" cases use desktop computers. (No, I don't know how to get at the full timestamp on mobile devices. Quick search on meta didn't turn up anything useful. Sorry.) $\endgroup$
    – M Oehm
    Jan 1, 2018 at 9:24
4
$\begingroup$

List of all 68 4 digit squares: (from $32^2$ to $99^2$)

1024 2401 4356 6889
1089 2500 4489 7056
1156 2601 4624 7225
1225 2704 4761 7396
1296 2809 4900 7569
1369 2916 5041 7744
1444 3025 5184 7921
1521 3136 5329 8100
1600 3249 5476 8281
1681 3364 5625 8464
1764 3481 5776 8649
1849 3600 5929 8836
1936 3721 6084 9025
2025 3844 6241 9216
2116 3969 6400 9409
2209 4096 6561 9604
2304 4225 6724 9801

Frequency analysis could be very helpful here:

No.|Freq
--------
4  | 37  
6  | 36  
1  | 34  
2  | 34  
0  | 30  
9  | 28  
5  | 21  
8  | 19  
3  | 18  
7  | 15  

We can see that 5,8,3 and 7 appear a lot less than the rest. So the number is probably made up of the other numbers.

Removing all numbers with 4 or 6:

1089 2500 7225
1225 2809 3025
7921 1521 5329
8100 8281 5929
3721 9025 2025
2209 9801

A lot of remaining numbers have 2s in them:

1089 8100 9801

And the lest 3 numbers all have a 0, 1 or 8.

So your pin will be made up of the numbers 4, 6, 2 and one of 0 1 and 8

List of 4 digit squares which have the digits 4, 6 and 2:

4626 6241 6724

You can see that the only one of those with a 0, 1 or 8 is 6241

So your pin is

6241

$\endgroup$
2
$\begingroup$

Just to verify that the solution is indeed unique (the other solutions make the reasonable assumption to exclude some numbers just because they don't share the most common digits), I whipped up an ugly brute force solution:

bass@box:~$ mkdir -p se/pin
bass@box:~$ cd se/pin
bass@box:~/se/pin$ for x in `seq 32 99`; do expr $x '*' $x >> foursquare.txt; done
bass@box:~/se/pin$ wc -l foursquare.txt 
68 foursquare.txt
bass@box:~/se/pin$ for x in `cat foursquare.txt`; do echo $x | perl -naF'' -le 'print "(".join("|",@F).")"' | xargs -I REGEXP sh -c 'echo -n "REGEXP: "; egrep -c -e "REGEXP" foursquare.txt';  done |sort -nk2 | tail -5

Which outputs the following:

(6|7|2|4): 65
(1|2|9|6): 66
(2|9|1|6): 66
(9|2|1|6): 66
(6|2|4|1): 68

So yeah, the solution is unique, and there are three "next best choices", which are all anagrams of each other.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.