Math gurus to the rescue!

ATLien247

Diamond Member
Feb 1, 2000
4,597
0
0
I've come across a problem that I know can be solved using some form of higher math, but I just can't get my puny brain around it. I'm trying to figure out how many rolls of labels I will need to redo the numbering system in a file room. The labels I typically use come in rolls of 250, one number per roll. I have roughly 23K files to do, each requiring a unique six digit number. These unique numbers will range from 010000-150000.

My first attempt was: (23000*6)/250

But then I realized that while that gives me some idea, it doesn't tell me how many of each number I'll need.

Any takers?
 

hypn0tik

Diamond Member
Jul 5, 2005
5,866
2
0
(23000 files*6 numbers/file) / 250(numbers/roll) gives you the number of rolls you'll need (works out to 552).

We'll also assume that the likelihood of all numbers is the same.

Now, break up the 552 rolls into 6 (one for each slot). This gives you 92 rolls for each slot. Here, by slot I am referring to the position of the digit in your 6-digit number.

In your 6 digit numbers, your first slot can only be a 0 or 1, your 2nd slot can only be 0-4 and your remaining 4 slots can be 0-9.

So, with the 92 rolls for the first slot, you want to buy (92/2) rolls of the number 0 and (92/2) rolls of the number 1.

For the 2nd slot, you want to buy (92/5) rolls of the number 0, (92/5) rolls of the number 1 and so on up to 4. Now, we really don't care about the 5 in the 2nd slot since there is only one number, so you're not going to buy an entire roll for it.

For the other slots, you have an equal probability of each number showing up. Of the 552 rolls, you used up 184 rolls for your first 2 slots. You're left with 368 rolls. You are going to spread these out evenly among 10 numbers (0-9) so you'll want to get about 36-37 rolls each of 0-9.

So, in total you should order:

0 - 1: 92/2 + 92/5 + 37 ~ 101 rolls each
2-5: 92/5 + 37 ~ 55 rolls each
6-9: ~ 37 rolls each

In total, you should buy 570 rolls (which is close enough to 552. You can opt to use 36 instead of 37 rolls for a grand total of 560 rolls).
 

Anubis

No Lifer
Aug 31, 2001
78,712
427
126
tbqhwy.com
Originally posted by: hypn0tik
(23000 files*6 numbers/file) / 250(numbers/roll) gives you the number of rolls you'll need (works out to 552).

We'll also assume that the likelihood of all numbers is the same.

Now, break up the 552 rolls into 6 (one for each slot). This gives you 92 rolls for each slot. Here, by slot I am referring to the position of the digit in your 6-digit number.

In your 6 digit numbers, your first slot can only be a 0 or 1, your 2nd slot can only be 0-4 and your remaining 4 slots can be 0-9.

So, with the 92 rolls for the first slot, you want to buy (92/2) rolls of the number 0 and (92/2) rolls of the number 1.

For the 2nd slot, you want to buy (92/5) rolls of the number 0, (92/5) rolls of the number 1 and so on up to 4. Now, we really don't care about the 5 in the 2nd slot since there is only one number, so you're not going to buy an entire roll for it.

For the other slots, you have an equal probability of each number showing up. Of the 552 rolls, you used up 184 rolls for your first 2 slots. You're left with 368 rolls. You are going to spread these out evenly among 10 numbers (0-9) so you'll want to get about 36-37 rolls each of 0-9.

So, in total you should order:

0 - 1: 92/2 + 92/5 + 37 ~ 101 rolls each
2-5: 92/5 + 37 ~ 55 rolls each
6-9: ~ 37 rolls each

In total, you should buy 570 rolls (which is close enough to 552. You can opt to use 36 instead of 37 rolls for a grand total of 560 rolls).

560 rolls x 6 numbers = 3360 individual numbers, was close with my in head math there at 3500
 

hypn0tik

Diamond Member
Jul 5, 2005
5,866
2
0
Originally posted by: Anubis
Originally posted by: hypn0tik
(23000 files*6 numbers/file) / 250(numbers/roll) gives you the number of rolls you'll need (works out to 552).

We'll also assume that the likelihood of all numbers is the same.

Now, break up the 552 rolls into 6 (one for each slot). This gives you 92 rolls for each slot. Here, by slot I am referring to the position of the digit in your 6-digit number.

In your 6 digit numbers, your first slot can only be a 0 or 1, your 2nd slot can only be 0-4 and your remaining 4 slots can be 0-9.

So, with the 92 rolls for the first slot, you want to buy (92/2) rolls of the number 0 and (92/2) rolls of the number 1.

For the 2nd slot, you want to buy (92/5) rolls of the number 0, (92/5) rolls of the number 1 and so on up to 4. Now, we really don't care about the 5 in the 2nd slot since there is only one number, so you're not going to buy an entire roll for it.

For the other slots, you have an equal probability of each number showing up. Of the 552 rolls, you used up 184 rolls for your first 2 slots. You're left with 368 rolls. You are going to spread these out evenly among 10 numbers (0-9) so you'll want to get about 36-37 rolls each of 0-9.

So, in total you should order:

0 - 1: 92/2 + 92/5 + 37 ~ 101 rolls each
2-5: 92/5 + 37 ~ 55 rolls each
6-9: ~ 37 rolls each

In total, you should buy 570 rolls (which is close enough to 552. You can opt to use 36 instead of 37 rolls for a grand total of 560 rolls).

560 rolls x 6 numbers = 3360 individual numbers, was close with my in head math there at 3500

I don't see why that number has any significance. Please explain.
 

Leros

Lifer
Jul 11, 2004
21,867
7
81
Originally posted by: hypn0tik
Originally posted by: Leros
What poor chump is getting stuck with this job?

Judging by the OP, it looks like ATLien247 is going to be doing it.

He could just be ordering the supplies for the person who is going to be doing it.
 

IEC

Elite Member
Super Moderator
Jun 10, 2004
14,596
6,070
136
They should just digitize their system :p

*ducks* :evil:
 

Leros

Lifer
Jul 11, 2004
21,867
7
81
Originally posted by: Spartan Niner
They should just digitize their system :p

*ducks* :evil:

Aren't people still required to have physical copies?
 

TuxDave

Lifer
Oct 8, 2002
10,571
3
71
Originally posted by: hypn0tik
We'll also assume that the likelihood of all numbers is the same.

Based on his number range I would expect a higher usage of the number 0 and 1 over the rest.


 

hypn0tik

Diamond Member
Jul 5, 2005
5,866
2
0
Originally posted by: TuxDave
Originally posted by: hypn0tik
We'll also assume that the likelihood of all numbers is the same.

Based on his number range I would expect a higher usage of the number 0 and 1 over the rest.

I took that into account....
 

TuxDave

Lifer
Oct 8, 2002
10,571
3
71
Originally posted by: hypn0tik
Originally posted by: TuxDave
Originally posted by: hypn0tik
We'll also assume that the likelihood of all numbers is the same.

Based on his number range I would expect a higher usage of the number 0 and 1 over the rest.

I took that into account....

Ok, then there's still some issue with the number of 1's and number of 0's. His number range is:

010000-150000.

There are:
50001 possibilities where the first number is 1
90000 possibilities where the first number of 0

I think you assumed a 50/50 split.
 

TuxDave

Lifer
Oct 8, 2002
10,571
3
71
Originally posted by: hypn0tik
Now, we really don't care about the 5 in the 2nd slot since there is only one number, so you're not going to buy an entire roll for it.


010000-150000

And there are 10001 combinations to have 5 in the 2nd slot.
050000 -> 059999
150000


On the side, for an extra challenge, the OP needs to specify the % probability that our solution will work since (aka 99% chance of having enough rolls)
 

hypn0tik

Diamond Member
Jul 5, 2005
5,866
2
0
Originally posted by: TuxDave
Originally posted by: hypn0tik
Now, we really don't care about the 5 in the 2nd slot since there is only one number, so you're not going to buy an entire roll for it.


010000-150000

And there are 10001 combinations to have 5 in the 2nd slot.
050000 -> 059999
150000


On the side, for an extra challenge, the OP needs to specify the % probability that our solution will work since (aka 99% chance of having enough rolls)

Ah yes. That case completely slipped my mind.

You sir are correct.
 

ATLien247

Diamond Member
Feb 1, 2000
4,597
0
0
Originally posted by: Leros
Originally posted by: hypn0tik
Originally posted by: Leros
What poor chump is getting stuck with this job?

Judging by the OP, it looks like ATLien247 is going to be doing it.

He could just be ordering the supplies for the person who is going to be doing it.

Actually, I'm just trying to figure out how much it will cost. The alternative is to print the six-digit numbers using a label printer, which is really where I come into the picture since it would fall somewhat under the realm of IT.
 

ATLien247

Diamond Member
Feb 1, 2000
4,597
0
0
Originally posted by: Leros
Originally posted by: Spartan Niner
They should just digitize their system :p

*ducks* :evil:

Aren't people still required to have physical copies?

Digitizing would be the best way to go in my opinion. We even have a nice document management system that is more than up to the task. All we would need is some bulk scanners, and a few poor souls to scan everything. What we don't have is support from executive management.

I doubt that we'd be required to keep physical copies once they've been digitized given the nature of the records. More than likely we would keep them in long-term storage somewhere as a precaution.
 

ATLien247

Diamond Member
Feb 1, 2000
4,597
0
0
Originally posted by: TuxDave
On the side, for an extra challenge, the OP needs to specify the % probability that our solution will work since (aka 99% chance of having enough rolls)

I don't really think that's an issue. If we don't have enough, we can always order more. The exercise was more geared towards minimizing cost, which would be accomplished by minimizing left-over labels.
 

ATLien247

Diamond Member
Feb 1, 2000
4,597
0
0
Originally posted by: jagec
"Higher math"?

You know, like something more complex than arithmetic. It looks like some of the responders have taken a (pre)calculus approach.
 

dullard

Elite Member
May 21, 2001
25,913
4,506
126
I took 5 minutes to write a program to randomly select 23000 6 digit numbers in that range. I ran it 10 times (not enough to really do good statistics, but 10 times gives pretty accurate numbers). I got bored after that.

I did assume that all numbers were equally likely. If you only use the numbers 010000 through 033000, then that assumtion was wrong. The distribution below will need to be changed, but the total number of rolls won't change much.

In all random cases:
0: 102-104 rolls
1: 81-84 rolls
2 to 4: 50-51 rolls
5-9:43-45 rolls
Total rolls: 556-558.

Assuming 2% mistakes when hand labelling, you'll need 569 rolls.
 

ATLien247

Diamond Member
Feb 1, 2000
4,597
0
0
Originally posted by: dullard
I took 5 minutes to write a program to randomly select 23000 6 digit numbers in that range. I ran it 10 times (not enough to really do good statistics, but 10 times gives pretty accurate numbers). I got bored after that.

I did assume that all numbers were equally likely. If you only use the numbers 010000 through 033000, then that assumtion was wrong. The distribution below will need to be changed, but the total number of rolls won't change much.

In all random cases:
0: 102-104 rolls
1: 81-84 rolls
2 to 4: 50-51 rolls
5-9:43-45 rolls
Total rolls: 556-558.

Assuming 2% mistakes when hand labelling, you'll need 569 rolls.

Mind posting or PMing the source?
 

dullard

Elite Member
May 21, 2001
25,913
4,506
126
Visual Basic 6.0 code is attached. Although, it should be a piece of cake to adjust it to any other language.

How the heck do I attach code that looks good?


Private Sub Command1_Click()
Dim i As Long 'Randomly selected integer
Dim j As Integer 'Loop counter
Dim k As Integer 'Loop counter
Dim counter(0 To 9) 'Counter of numbers used

Randomize (Timer)

For i = 0 To 9
counter(i) = 0
Next

For k = 1 To CInt(Text1)
i = Rnd() * 140000 + 10000
Label1 = i
If i < 100000 Then
counter(0) = counter(0) + 1
For j = 1 To 5
counter(Mid$(i, j, 1)) = counter(Mid$(i, j, 1)) + 1
Next
Else
For j = 1 To 6
counter(Mid$(i, j, 1)) = counter(Mid$(i, j, 1)) + 1
Next
End If
Next

For j = 0 To 9
lblnum(j) = CStr(j) & ": " & CStr(counter(j)) & ", " & CStr(counter(j) / 250) & ", " & CStr(Int(counter(j) / 250) + 1)
Next
End Sub