LIVE Mathematics on the web

Birthdays and other things
© 1997 Stephen Arnold

With thanks to Barry Kissane


Monday's child is fair of face,
Tuesday's child is full of grace,
Wednesday's child is full of woe,
Thursday's child has far to go,
Friday's child is kind and giving,
Saturday's child works hard for a living,
And the child who is born on the Sabbath day,
Is fair, and wise, and good, and gay.

Which are you?


How did you do that?

TI-80 / 82 / 83
TI-92
ClrHome

Input "DAY ",D
Input "MONTH ",M
Input "YEAR ",Y


If Y<100
Y+1900->Y
M->O
Y->T


If M<3
Then
M+12->M
Y-1->Y
End


2+D+2*M+iPart(3*(M+1)/5)+Y
+iPart(Y/4)-iPart(Y/100)
+iPart(Y/400)->W
7*fPart(W/7)->W

Disp {D,O,T}
Disp "FALLS ON A"


If W=0 Disp "SATURDAY"

If W=1
Disp "SUNDAY"

If W=2
Disp "MONDAY"

If W=3
Disp "TUESDAY"

If W=4
Disp "WEDNESDAY"

If W=5
Disp "THURSDAY"

If W=6
Disp "FRIDAY"


Stop
()
Prgm
Local d,m,y,w,o,t
ClrIO

Request "Day",d
expr(d)->d
Request "Month",m
expr(m)->m
Request "Year",y
expr(y)->y
If y<100 Then
y+1900->y
EndIf

m->o
y->t

If m<3 Then
m+12->m
y-1->y
EndIf

2+d+2*m+iPart(3*(m+1)/5)
+y+iPart(y/4)-iPart(y/100)
+iPart(y/400)->w

7*fPart(w/7)->w

Disp {d,o,t}
Disp "falls on a"

If w=1 Then
Disp "Sunday"
EndIf

If w=2 Then
Disp "Monday"
EndIf

If w=3 Then
Disp "Tuesday"
EndIf

If w=4 Then
Disp "Wednesday"
EndIf

If w=5 Then
Disp "Thursday"
EndIf

If w=6 Then
Disp "Friday"
EndIf

If w=7 Then
Disp "Saturday"
EndIf

EndPrgm
If you have any comments or suggestions (or you can help me with my JavaScript!), please drop me an email.