My SID project needs the user to type in the last 4 digits of a PI’s serial num in order to connect remotely.
I chose 4 as I thought (intuitively) that it was enough digits to almost certainly be unique in a class of 15 Pi.
Of course, if it takes one year 7 child x attempts in t time to get it right then imagine the number of attempts a class of 30 children working in “teams” of two takes to do this. then make it 2 digits – then 3 – then 4.
…….. so 30 mins later, all pupils have connected their laptops to their Pi 🙂
OK – lets try and me more scientific and find the probability of 1/2/3 or 4 digits letting us uniquely identify a Pi.
Turns outs to be one of those great maths problems called the “birthday problem” and that the probability of any 2 Pi out of 15 having same last digits of serial number is (in %) where r = num of Pi and d = number of hex digits is given by
a = (16^d)!
b = (16^d)^r)
c = ((16^d)-r)!
P(%) = 100*(1 – a/(b * c)
Substituting r = 15 and d =2 gives 34%
Substituting r = 15 and d =3 gives 2.5%
Substituting r = 15 and d = 4 gives 0.2%
So maybe we could get away with 3 digits but with say 30 Pi the numbers change to
Substituting r = 30 and d = 3 gives 10%
Substituting r = 30 and d = 4 gives 0.7%
So in a class of 30 you’d have to use 4 digits and so for compatibility for rich schools – I’ve stuck with 4 digits 🙂
Just for an exercise, I wondered if I converted the serial num into Base 30 (using 0,1,2….x,y,z) for digits I get this
Substituting r =15 and d =2 gives 11%
Substituting r =15 and d =3 gives 0.4%
and even for a class of 30
Substituting r =30 and d =2 gives 38%
Substituting r =30 and d =3 gives 1.6%
So I’d say we could get away with three Base 30 digits.
But since its a lot of trouble to convetr from Base 16 to Base 30, I’m going to stick with 4 hex digits and stick them on the side of each Pi 🙂