Recommend
2 
 Thumb up
 Hide
33 Posts
1 , 2  Next »   | 

BoardGameGeek» Forums » Everything Else » Chit Chat

Subject: Math help - Permutation or combination and how to figure rss

Your Tags: Add tags
Popular Tags: [View All]
Dwayne Hendrickson
United States
Oklahoma City
Oklahoma
flag msg tools
badge
Avatar
mbmbmbmbmb
Ok. I have seven slots, days of the week, and I am trying to determine every possible combination from each day of the week to all days of the week.

If I have a label
.......

representing the seven day slots then Monday would be
M......

and Sunday would be
......S

and all days would be
MTWTFSS

and Tuesday and Thursday would be
.T.T...

then how many different labels would I need to cover EVERY possible combinations of days? Would it be 7x6x5x4x3x2x1=5040? or is it MORE than that?

 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Billy McBoatface
United States
Lexington
Massachusetts
flag msg tools
KGS is the #1 web site for playing go over the internet. Visit now!
badge
Yes, I really am that awesome.
Avatar
mbmbmbmbmb
It is 7! if Tuesday and Thursday and Saturday and Sunday are different. If they're the same, it is 7!/(2!*2!), or 1260 different labels.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Bryan Thunkd
United States
Florence
MA
flag msg tools
badge
Avatar
mbmbmbmbmb
Okay, I'll bite... exactly what are you using the labels for?
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Matt
United States
Central Coast
California
flag msg tools
0110100110010110
badge
Avatar
mbmbmbmbmb
It sounds like you just want to print out the patterns corresponding to each possible subset of days, but keep the days in their correct positions, including:

No days - .......

and

All Days - SMTWTFS

There are 2^7 subsets of 7 days, so you will need 128 labels.
9 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Dwayne Hendrickson
United States
Oklahoma City
Oklahoma
flag msg tools
badge
Avatar
mbmbmbmbmb
Thunkd wrote:
Okay, I'll bite... exactly what are you using the labels for?


The labels have to do with a batch scheduling system on MVS mainframes. Currently if someone wants their job to run on Monday they code the scheduling system with WDAYS 1, if they want it to run Tue & Wed they would code it 2,3.

I can build system wide scheduling with standardized names so new folks wouldn't have to learn some of the more complex scheduling and would just enter this label to reap the benefits. They would know there are seven spots for days of the week. Run on Monday? code M...... Want it run the first Tuesday of the month after the first Monday? code 1ST_T_AF_M

I was wanting to know how many I would have to code to cover every possible combo before I ventured into that craziness
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Dwayne Hendrickson
United States
Oklahoma City
Oklahoma
flag msg tools
badge
Avatar
mbmbmbmbmb
wmshub wrote:
It is 7! if Tuesday and Thursday and Saturday and Sunday are different. If they're the same, it is 7!/(2!*2!), or 1260 different labels.


Tuesday & Thursday are unique and different from Saturday and Sunday as well as Tuesday and Wednesday.


So I would have a

M......
MT.....
M.W....
M..T...
M...F..


and a
MTW....
MT.T...
MT..F..

so EVERY possible combination of day/days
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Erik Henry
United States
Houston
Texas
flag msg tools
badge
Avatar
mbmbmb
I second Matt. 127 if it's going to include at least one day.
3 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
¡dn ʇǝƃ ʇ,uɐɔ ı puɐ uǝllɐɟ ǝʌ,ı
Canada
Chestermere
Alberta
flag msg tools
Life lesson: Hamsters are NOT diswasher safe.
badge
There are 10 types of people-- those who understand binary, and those who don't.
Avatar
mbmbmbmbmb
okiedokie wrote:

Tuesday & Thursday are unique and different from Saturday and Sunday as well as Tuesday and Wednesday.


So I would have a

M......
MT.....
M.W....
M..T...
M...F..


and a
MTW....
MT.T...
MT..F..

so EVERY possible combination of day/days


I would label Thursday "H" and Sunday "N", so that you have unique labels- M T W H F S N
Technically, with a calendar in North America the week begins on Sunday, not Monday, but that might be a moot point.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Walt
United States
Orange County
California
flag msg tools
Before terraforming Mars, Surviving Mars is required: Paradox Interactive; Steam.
badge
Please contact me about board gaming in Orange County.
Avatar
mbmbmbmbmb
okiedokie wrote:
... Want it run the first Tuesday of the month after the first Monday? code 1ST_T_AF_M

I was wanting to know how many I would have to code to cover every possible combo before I ventured into that craziness

I think I'd use two letter abbreviations for days: Mo Tu We Th Fr Sa Su. But I suspect a bigger problem is when something must run (frex monthly), but the designated day is a holiday. Do you shift forward or backward? What about computing Easter or Hanukkah? Remember leap years.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Hiding Tiger
Australia
Parmelia
Western Australia
flag msg tools
Grrrrrrrrowf!
badge
Grrrrr aaarrrggghhh
Avatar
mbmbmbmbmb
I third Matt and Erik. Each day has no influence on the others, and they must remain in order, so each day has 2 possibilities, and there are seven of them, so 2^7, or 128. And as Erik pointed out, if there needs to be at least one day then one of those 128 is not needed, leaving 127.

If the order was not predetermined (ie the "W" could be anywhere in the sequence), there would be a lot more.
2 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Billy McBoatface
United States
Lexington
Massachusetts
flag msg tools
KGS is the #1 web site for playing go over the internet. Visit now!
badge
Yes, I really am that awesome.
Avatar
mbmbmbmbmb
Ah, I thought you could rearrange the days, and that the "."'s were just for example. Right, the people who say 127 are correct.
2 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Dwayne Hendrickson
United States
Oklahoma City
Oklahoma
flag msg tools
badge
Avatar
mbmbmbmbmb
MABBY wrote:
okiedokie wrote:

Tuesday & Thursday are unique and different from Saturday and Sunday as well as Tuesday and Wednesday.


So I would have a

M......
MT.....
M.W....
M..T...
M...F..


and a
MTW....
MT.T...
MT..F..

so EVERY possible combination of day/days


I would label Thursday "H" and Sunday "N", so that you have unique labels- M T W H F S N
Technically, with a calendar in North America the week begins on Sunday, not Monday, but that might be a moot point.


A scheduling calendar doesn't always follow a printed calendar. Our work week starts on Monday so Monday is the beginning of the.

This will make your head explode, to code the first day of the week you place 1 in the WDAYS field. Therefore:

Mon = 1
Tue = 2
Wed = 3
Thu = 4
Fri = 5
Sat = 6
Sun = 0

Yup, the 7th day of the week is 0.

Don't ask me why, but that's the way it is.

Quote:

I think I'd use two letter abbreviations for days: Mo Tu We Th Fr Sa Su. But I suspect a bigger problem is when something must run (frex monthly), but the designated day is a holiday. Do you shift forward or backward? What about computing Easter or Hanukkah? Remember leap years.


A label has only so many characters and I wanted to keep it visually informational as well so I went with MTWTFSS for the format and utilizing . in days of the week where the job doesn't run.

If the designated day is a holiday, that's when we take the referenced run day, compare it to a holiday calendar and then other coding determines if we:
1) run anyway
2) don't run
3) shift to previous workday
4) shift to prior workday

Leap years are taken into account, even that weird century divisible by 400 rule. Also, we only work with the 11 Federally recognized holidays.
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Bryan Thunkd
United States
Florence
MA
flag msg tools
badge
Avatar
mbmbmbmbmb
okiedokie wrote:
This will make your head explode, to code the first day of the week you place 1 in the WDAYS field. Therefore:

Mon = 1
Tue = 2
Wed = 3
Thu = 4
Fri = 5
Sat = 6
Sun = 0

Yup, the 7th day of the week is 0.

Don't ask me why, but that's the way it is.
I'm confused why you think Sunday is the seventh item. Most computer programs languages start counting at zero. So the first item in an array will be assigned to array(0), the second array(1), etc. That makes more sense than putting zero after six.
3 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
John Breckenridge
United States
Richmond
Rhode Island
flag msg tools
Avatar
mbmbmbmbmb
MABBY wrote:

I would label Thursday "H" and Sunday "N", so that you have unique labels- M T W H F S N
Technically, with a calendar in North America the week begins on Sunday, not Monday, but that might be a moot point.


When I was in college, our schedules used R for Thursday. The MWF classes were shorter than the TR classes
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Dwayne Hendrickson
United States
Oklahoma City
Oklahoma
flag msg tools
badge
Avatar
mbmbmbmbmb
Thunkd wrote:
okiedokie wrote:
This will make your head explode, to code the first day of the week you place 1 in the WDAYS field. Therefore:

Mon = 1
Tue = 2
Wed = 3
Thu = 4
Fri = 5
Sat = 6
Sun = 0

Yup, the 7th day of the week is 0.

Don't ask me why, but that's the way it is.
I'm confused why you think Sunday is the seventh item. Most computer programs languages start counting at zero. So the first item in an array will be assigned to array(0), the second array(1), etc. That makes more sense than putting zero after six.


From the Control-M for zOS User Guide version 8.0 Page 686 under the section regarding the WDAYS parameter
Quote:

Days of each week in the month on which to schedule a job. (The
months in which to order jobs are specified in the MONTHS
parameter.) Various formats (described later) can be used to specify
WDAYS; for example, 2 means the second day of the week, L2 means
the day before the last day of the week.

Note: At time of installation, the INCONTROL administrator selects
either Sunday or Monday as the “first” day of the week. Your
INCONTROL administrator can tell you whether the week begins on
Sunday or Monday at your site.
The first six days of the week are coded 1 through 6. The last day of
the week is coded 0 (zero). All examples in this chapter assume
Monday is the first day of the week.
In these examples, Monday = 1,
Tuesday = 2, ..., Saturday = 6, and Sunday = 0.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Bryan Thunkd
United States
Florence
MA
flag msg tools
badge
Avatar
mbmbmbmbmb
okiedokie wrote:
Thunkd wrote:
okiedokie wrote:
This will make your head explode, to code the first day of the week you place 1 in the WDAYS field. Therefore:

Mon = 1
Tue = 2
Wed = 3
Thu = 4
Fri = 5
Sat = 6
Sun = 0

Yup, the 7th day of the week is 0.

Don't ask me why, but that's the way it is.
I'm confused why you think Sunday is the seventh item. Most computer programs languages start counting at zero. So the first item in an array will be assigned to array(0), the second array(1), etc. That makes more sense than putting zero after six.


From the Control-M for zOS User Guide version 8.0 Page 686 under the section regarding the WDAYS parameter
Quote:

Days of each week in the month on which to schedule a job. (The
months in which to order jobs are specified in the MONTHS
parameter.) Various formats (described later) can be used to specify
WDAYS; for example, 2 means the second day of the week, L2 means
the day before the last day of the week.

Note: At time of installation, the INCONTROL administrator selects
either Sunday or Monday as the “first” day of the week. Your
INCONTROL administrator can tell you whether the week begins on
Sunday or Monday at your site.
The first six days of the week are coded 1 through 6. The last day of
the week is coded 0 (zero). All examples in this chapter assume
Monday is the first day of the week.
In these examples, Monday = 1,
Tuesday = 2, ..., Saturday = 6, and Sunday = 0.
I dunno... sounds kind of like they're trying to redefine counting numbers. If you're going to be cycling through sequences it would be awkward to have a sequence run 1 through 6 and then stop with 0. Not to say it's not set up that way... it just seems really silly to set it up that way.
2 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Dwayne Hendrickson
United States
Oklahoma City
Oklahoma
flag msg tools
badge
Avatar
mbmbmbmbmb
If it helps, I do believe the software was originally developed by the Israeli army.
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
¡dn ʇǝƃ ʇ,uɐɔ ı puɐ uǝllɐɟ ǝʌ,ı
Canada
Chestermere
Alberta
flag msg tools
Life lesson: Hamsters are NOT diswasher safe.
badge
There are 10 types of people-- those who understand binary, and those who don't.
Avatar
mbmbmbmbmb
Irrelevant to the matter but, in many European countries, the days of the week do begin on Monday, and Sunday is the last day shown on a calendar.
You may think that it isn't a big deal, but it really messes with your mind when you see a calendar where Sunday isn't shown first.
Having Sunday = 0 is a way of keeping it first as it would be on a calendar but not first (#1) of the days of the work week.
Sunday = 7 would seem very odd to me, while I can accept Sunday = 0 but only if you count 0, 1, 2, 3, etc.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Bryan Thunkd
United States
Florence
MA
flag msg tools
badge
Avatar
mbmbmbmbmb
MABBY wrote:
Sunday = 7 would seem very odd to me, while I can accept Sunday = 0 but only if you count 0, 1, 2, 3, etc.
Sunday = 7 doesn't seem that odd to me because when I think of a week, I always think of it starting on Monday. Plus there's that whole "and on the seventh day he rested" bit.

But yeah, having a calendar where Sunday wasn't shown as the first day would be jarring, but only because I'm not used to it. It would actually fit with how I think about the week better though.
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Matt
United States
Central Coast
California
flag msg tools
0110100110010110
badge
Avatar
mbmbmbmbmb
Thunkd wrote:
Plus there's that whole "and on the seventh day he rested" bit.


That's the Sabbath, which is Saturday, the seventh day. Sunday is the first day, and was originally celebrated by Christians not as a sabbath (except for some Puritan branches) but as the day of Christ's resurrection and therefore of his followers' deliverance. A "New Beginning" sort of thing.

Christians shifted to Sunday rest over a pretty good span of time, but they have never debated that Saturday is the seventh day of the week. In fact, they did a lot of work to justify the shift of their rest day to Sunday (particularly in regards to the Fourth Commandment).

edit: splelling
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Bryan Thunkd
United States
Florence
MA
flag msg tools
badge
Avatar
mbmbmbmbmb
Shows what I know about religion.
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Christopher Dearlove
United Kingdom
Chelmsford
Essex
flag msg tools
SoRCon 11 23-25 Feb 2018 Basildon UK http://www.sorcon.co.uk
badge
Avatar
mbmbmbmbmb
Calendrical numbering can be crazy.

For example in the programming language C (and hence, due to C's ubiquity, in other places too) in its "struct tm" days of the week are numbered 0 to 6. Days of the month are numbered 1 to 31, because that's how we actually use them. But although we also use 1 to 12 for months, struct tm uses 0 to 11.

And (not in struct tm) don't even think about weeks of the year. There is an official international standard (ISO) definition out there. But it's nuts. Each week starts on Monday (not Sunday). But week numbers are assigned to Thursdays. Week 1 or a year is thus the week containing 4th January, and there may or may not be a week 0. And there may or may not be a week 53. There will always be one or the other - and there can be both (in a leap year that starts on a Sunday).
3 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Walt
United States
Orange County
California
flag msg tools
Before terraforming Mars, Surviving Mars is required: Paradox Interactive; Steam.
badge
Please contact me about board gaming in Orange County.
Avatar
mbmbmbmbmb
Dearlove wrote:
Calendrical numbering can be crazy.

For example in the programming language C (and hence, due to C's ubiquity, in other places too) in its "struct tm" days of the week are numbered 0 to 6. Days of the month are numbered 1 to 31, because that's how we actually use them. But although we also use 1 to 12 for months, struct tm uses 0 to 11.

And (not in struct tm) don't even think about weeks of the year. There is an official international standard (ISO) definition out there. But it's nuts. Each week starts on Monday (not Sunday). But week numbers are assigned to Thursdays. Week 1 or a year is thus the week containing 4th January, and there may or may not be a week 0. And there may or may not be a week 53. There will always be one or the other - and there can be both (in a leap year that starts on a Sunday).

/facepalm shake
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Julius Waller
Belgium
Brussels
flag msg tools
badge
Avatar
mbmbmbmbmb
Thunkd wrote:
okiedokie wrote:
Thunkd wrote:
okiedokie wrote:
This will make your head explode, to code the first day of the week you place 1 in the WDAYS field. Therefore:

Mon = 1
Tue = 2
Wed = 3
Thu = 4
Fri = 5
Sat = 6
Sun = 0

Yup, the 7th day of the week is 0.

Don't ask me why, but that's the way it is.
I'm confused why you think Sunday is the seventh item. Most computer programs languages start counting at zero. So the first item in an array will be assigned to array(0), the second array(1), etc. That makes more sense than putting zero after six.


From the Control-M for zOS User Guide version 8.0 Page 686 under the section regarding the WDAYS parameter
Quote:

Days of each week in the month on which to schedule a job. (The
months in which to order jobs are specified in the MONTHS
parameter.) Various formats (described later) can be used to specify
WDAYS; for example, 2 means the second day of the week, L2 means
the day before the last day of the week.

Note: At time of installation, the INCONTROL administrator selects
either Sunday or Monday as the “first” day of the week. Your
INCONTROL administrator can tell you whether the week begins on
Sunday or Monday at your site.
The first six days of the week are coded 1 through 6. The last day of
the week is coded 0 (zero). All examples in this chapter assume
Monday is the first day of the week.
In these examples, Monday = 1,
Tuesday = 2, ..., Saturday = 6, and Sunday = 0.
I dunno... sounds kind of like they're trying to redefine counting numbers. If you're going to be cycling through sequences it would be awkward to have a sequence run 1 through 6 and then stop with 0. Not to say it's not set up that way... it just seems really silly to set it up that way.


Absolutely wrong - they were using the octal system. Certainly long ago there were a number of competing systems used in programming. Octal and hexadecimal were and to a certain extent are quite common. Nothing strange about what they propose there.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Walt
United States
Orange County
California
flag msg tools
Before terraforming Mars, Surviving Mars is required: Paradox Interactive; Steam.
badge
Please contact me about board gaming in Orange County.
Avatar
mbmbmbmbmb
TrustyJules wrote:
okiedokie wrote:
This will make your head explode, to code the first day of the week you place 1 in the WDAYS field. Therefore:

Mon = 1
Tue = 2
Wed = 3
Thu = 4
Fri = 5
Sat = 6
Sun = 0

Yup, the 7th day of the week is 0.


Absolutely wrong - they were using the octal system. Certainly long ago there were a number of competing systems used in programming. Octal and hexadecimal were and to a certain extent are quite common. Nothing strange about what they propose there.

Octal, base 8, commonly uses the numerals (symbols for octal digits) 0 to 7. Eight is 10, 1×8 + 0. Monday to Sunday can be 1 to 7 in octal, easily; or 0 to 6.

Numbering from zero is a C convention, naïvely thought to increase efficiency.

(There are 10 kinds of people: those who understand binary and those who don't.)
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
1 , 2  Next »   | 
Front Page | Welcome | Contact | Privacy Policy | Terms of Service | Advertise | Support BGG | Feeds RSS
Geekdo, BoardGameGeek, the Geekdo logo, and the BoardGameGeek logo are trademarks of BoardGameGeek, LLC.