HP 35s Day of the week program



#5

Hi all, I was watching a tv show about an extraordinary man who calculates mentally the day of the week of any date. Then I wrote this program for the HP 35s that uses one of that algorithms.

DAY OF THE WEEK FOR HP 35s (FROM 1901 TO 2099)

Table of Contents
=================
1 Using the program
2 Program listing
3 Registers
4 Revision

1 Using the program
~~~~~~~~~~~~~~~~~~~~

First execute the program: XEQ W ENTER.
Insert the day and press R/S.
Insert the month and press R/S.
Insert the year (from 1901 to 2099) and press R/S.

Then it will show a number that corresponds to the
day of the week according to this table:

Day Number
-----------+--------
Sunday 0
Monday 1
Tuesday 2
Wednesday 3
Thursday 4
Friday 5
Saturday 6

2 Program listing
~~~~~~~~~~~~~~~~~~

Line Instruction
------+--------------------
W001 LBL W
W002 INPUT D
W003 INPUT M
W004 INPUT Y
W005 033614625035
W006 1E13
W007 10
W008 RCL M
W009 y^x
W010 ÷
W011 ÷
W012 FP
W013 10
W014 x
W015 IP
W016 STO N
W017 RCL Y
W018 4
W019 RMDR
W020 x!=0? ;(not equal)
W021 GTO W038
W022 RCL Y
W023 100
W024 RMDR
W025 x!=0? ;(not equal)
W026 GTO W032
W027 RCL Y
W028 400
W029 RMDR
W030 x!=0? ;(not equal)
W031 GTO W038
W032 RCL M
W033 3
W034 x>y?
W035 GTO W038
W036 1
W037 STO+ N
W038 RCL Y
W039 1
W040 -
W041 ENTER
W042 ENTER
W043 ENTER
W044 100
W045 INT÷
W046 1
W047 +
W048 4
W049 INT÷
W050 -3
W051 x
W052 x<>y
W053 4
W054 INT÷
W055 +
W056 +
W057 RCL N
W058 +
W059 RCL D
W060 +
W061 7
W062 RMDR
W063 STO W
W064 VIEW W
W065 RTN

234 Bytes

3 Registers
~~~~~~~~~~~~

Register Use Notes
----------+-----------------+----------------
D Day of month
M Month
Y Year
N Modulus Internal usage
W Day of the week

4 Revision
~~~~~~~~~~~

06/23/10 - Initial release


Edited: 23 June 2010, 5:29 p.m. after one or more responses were posted


#6

Sorry, there is a problem with leap years. I will fix it.

#7

Fixed.

#8

Hello Pablo,

Thanks for the program. I think I saw the show about the man who could tell the day of the week for any given date. There was a discussion here a while back about a method to determine on which day of the week the last of February, 7 March, 4 April, 9 May, 6 June, 11 July, 8 August, 5 September, 10 October, 7 November and 12 December will fall in a given year. From there you can quickly figure what day of week any other date will fall. It was called the "doomsday" method, but I preferred to think of it as the "magic day", so that's what I called the program I wrote to calculate it. The meat of the program is the equation below, which was found at the links in message 8 of the discussion.

RMDR((2+REGX+IP(REGX/4)-IP(REGX/100)+IP(REGX/400),7)

The year you are interested in must be in stack register x.

.

Edited: 25 June 2010, 1:17 p.m.


Possibly Related Threads...
Thread Author Replies Views Last Post
  An amazing day: Giving a talk at HP about their calculators Geir Isene 9 2,979 12-16-2013, 06:14 PM
Last Post: aurelio
  HP Prime: run a program in another program Davi Ribeiro de Oliveira 6 1,674 11-11-2013, 08:28 PM
Last Post: Davi Ribeiro de Oliveira
  Interesting Base Conversions - Porting a 1975 HP 25 Program to the HP 35S Eddie W. Shore 1 882 10-13-2013, 07:49 PM
Last Post: BruceH
  HHC 2013 Day 2 Highlights Eddie W. Shore 6 1,681 09-23-2013, 04:03 PM
Last Post: Kimberly Thompson
  HHC 2013: Day 1 Highlights Eddie W. Shore 28 5,196 09-23-2013, 03:22 PM
Last Post: Brad Barton
  Flash Flood Warning: 9/16/2013 (One Week from HHC13) Eddie W. Shore 8 1,988 09-17-2013, 09:20 PM
Last Post: Craig Ruff
  HHC 2013: One Week To Go Eddie W. Shore 2 1,010 09-13-2013, 05:32 PM
Last Post: Craig Ruff
  Auction Scam of the Week? Frido Bohn 4 1,380 06-03-2013, 01:45 PM
Last Post: Mike Morrow
  Planar Triangles Program: HP 35S Eddie W. Shore 0 628 06-02-2013, 11:15 AM
Last Post: Eddie W. Shore
  Happy Mother's Day! Eddie W. Shore 1 764 05-12-2013, 11:35 AM
Last Post: Walter B

Forum Jump: