Figuring out first day of a month

  • Thread starter Thread starter MrGillig
  • Start date Start date
AI Thread Summary
The discussion revolves around calculating the first day of the month given a specific date and the corresponding day of the week. The user initially struggles with the calculation, attempting to use modular arithmetic to determine the weekday of the first day based on the current day and its weekday number. After some confusion regarding whether to start counting days of the week from 0 or 1, the user realizes that adding 7 to negative results helps identify the correct weekday. Ultimately, the user clarifies the calculation method and expresses gratitude for the assistance received. The thread highlights the importance of understanding modular arithmetic in date calculations.
MrGillig
Messages
4
Reaction score
0
Hey guys!

Say I have a date. Let's just take todays date 05/04/2009.

And say I have numbers 0 - 6 corresponding to each day of the week ie. Sunday is 0, Monday is 1 etc.

From just knowing the day of the date, in this case 5, and that today is a Sunday, is it possible to calculate what the first day of the month was? By using the numbers that correspond to each day, of course.

So, I'll reiterate: from just knowing that its the 5th and that it's a Sunday (0), is it possible to figure out what the first day of the month was?
 
Mathematics news on Phys.org
Let today be the dth day of the month, and the day of the week be w. The weekday of the first day of the month is the least residue of w-(d-1) mod 7 and in general, the weekday of the kth day is the least residue of w-(d-k) mod 7.
 
I'm confused. If I were to plug the values in for today would they then be "0 - (5+1) % 7". When I calculate this I seem to get -6, which isn't Wednesday. Did I mess up the calculation somewhere?

EDIT: Just read your edit sorry. Gonna try again.
 
Sorry man but I'm still confused. If I plug in the values for today, for instance, I get -4. Should I be counting from 1 instead of 0 for the days of the week ie. Sunday is 1, Monday is 2 etc?
 
MrGillig said:
Sorry man but I'm still confused. If I plug in the values for today, for instance, I get -4. Should I be counting from 1 instead of 0 for the days of the week ie. Sunday is 1, Monday is 2 etc?

-4 = 3 (mod 7).
 
Ah I realize now how to equate it to correspond to the day of the week. If it happens to be below 0, I add 7 and get the result for the number corresponding to the first day of the month.

Thanks for the help!
 
Seemingly by some mathematical coincidence, a hexagon of sides 2,2,7,7, 11, and 11 can be inscribed in a circle of radius 7. The other day I saw a math problem on line, which they said came from a Polish Olympiad, where you compute the length x of the 3rd side which is the same as the radius, so that the sides of length 2,x, and 11 are inscribed on the arc of a semi-circle. The law of cosines applied twice gives the answer for x of exactly 7, but the arithmetic is so complex that the...
Thread 'Unit Circle Double Angle Derivations'
Here I made a terrible mistake of assuming this to be an equilateral triangle and set 2sinx=1 => x=pi/6. Although this did derive the double angle formulas it also led into a terrible mess trying to find all the combinations of sides. I must have been tired and just assumed 6x=180 and 2sinx=1. By that time, I was so mindset that I nearly scolded a person for even saying 90-x. I wonder if this is a case of biased observation that seeks to dis credit me like Jesus of Nazareth since in reality...
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
Back
Top