Maths Problem - Any Mathematicians out there?
Maths Problem - Any Mathematicians out there?
Author
Discussion

StuStu

Original Poster:

1,031 posts

251 months

Wednesday 25th July 2012
quotequote all
Challenge for you that is hurting my brain …

I have 10 digit sequential reference numbers, each with a check digit as the 11th digit:
0000000001 (chk)
0000000002 (chk)
0000000003 (chk)
etc

Assuming that all the reference numbers are used (9 billion?) How many times will the last 4 digits (including check digit) be the same as another reference number's last 4 digits?

Many thanks

StottyZr

6,860 posts

183 months

Wednesday 25th July 2012
quotequote all
How many variations are possible from the first 7 digits? This is your answer... I think, I've looked at the issue for about 20secs and I'm trying to respond first hehe

Edit: Damn, just realised ur check digit is going to be either 0 or 1. This confuses matters somewhat frown

Edited by StottyZr on Wednesday 25th July 14:41

SturdyHSV

10,318 posts

187 months

Wednesday 25th July 2012
quotequote all
StuStu said:
Challenge for you that is hurting my brain …

I have 10 digit sequential reference numbers, each with a check digit as the 11th digit:
0000000001 (chk)
0000000002 (chk)
0000000003 (chk)
etc

Assuming that all the reference numbers are used (9 billion?) How many times will the last 4 digits (including check digit) be the same as another reference number's last 4 digits?

Many thanks
I presume I've missed the point, but would you not need to know how the chk digit is calculated?

ewenm

28,506 posts

265 months

Wednesday 25th July 2012
quotequote all
Can't answer unless we know how you calculate the check digit.

For 10-digit numbers of the format xxxxxxxyyy there are xxxxxxx numbers with yyy as the last 3 digits, so 1 million combinations with the same last 3 digits.

NormalWisdom

2,168 posts

179 months

Wednesday 25th July 2012
quotequote all
ewenm said:
1 million combinations with the same last 3 digits.
Surely it's 9,999,999 combinations??

ewenm

28,506 posts

265 months

Wednesday 25th July 2012
quotequote all
NormalWisdom said:
ewenm said:
1 million combinations with the same last 3 digits.
Surely it's 9,999,999 combinations??
Oops, yes 10 million combinations (including 0,000,000,yyy)

StuStu

Original Poster:

1,031 posts

251 months

Wednesday 25th July 2012
quotequote all
Luhn algorithm being used to calculate check digit apparently

ewenm

28,506 posts

265 months

Wednesday 25th July 2012
quotequote all
OK, the Luhn algorithm is relatively simple and from a little experiment I've just done it appears to give a even distribution of check digits so the 11th digit in your number can just be considered as any other number.

So you want to know how many combinations there are of x,xxx,xxx,yyy-y where the yyy-y are identical. 10 million I think. Of course, if my assumption about the even spread of results from the Luhn algorithm is wrong, then this is wrong too and it would depend on which check digit you were interested in as to how many matching last 4 combinations there are.

seanh

104 posts

304 months

Wednesday 25th July 2012
quotequote all
Given a number of the form xxxxxxxyyy, Luhn's algorithm will return a unique, evenly distributed, check digit z to provide an extended number xxxxxxxyyyz. Therefore, for every valid yyyz combination there will be 10,000,000 numbers sharing those last 4 digits.

StuStu

Original Poster:

1,031 posts

251 months

Wednesday 25th July 2012
quotequote all
Thank you all smile

StuStu

Original Poster:

1,031 posts

251 months

Thursday 26th July 2012
quotequote all
And Thank you Sean for the update

Cunning Punt

486 posts

173 months

Thursday 26th July 2012
quotequote all

Pistonheads and random number generation.

Seed Matters.



What a marvellously eclectic place this is.

'punt

jimmyone

954 posts

162 months

Thursday 26th July 2012
quotequote all
42

Dogwatch

6,353 posts

242 months

Thursday 26th July 2012
quotequote all
jimmyone said:
42
cool