Post Reply 
(49G) Friday 13th calculation
06-21-2014, 02:09 PM (This post was last modified: 06-15-2017 01:46 PM by Gene.)
Post: #1
(49G) Friday 13th calculation
The programme returns the dates of Friday 13th for a valid year entry using dd.mmyyyy format.

The programme works for versions 1.19-6 & 2.10-8.

Eg For 1,953 the programme returns 13.021953, 13.031953 & 13.111953.

::
CK1&Dispatch
BINT1
::
% 1000000.
%/
%13
%+
BINT12
ZERO_DO
% .01
%+
DUP
% 13.063
DDAYS
%7
%MOD
%0=
IT
DUP
LOOP
DROP
;
;

Improvements welcome.
Find all posts by this user
Quote this message in a reply
06-22-2014, 06:16 AM
Post: #2
RE: HP 49G Friday 13th calculation
Here's my ancient User RPL version, which was included in "One-Minute Marvels" by Richard Nelson and Wlodek Mier-Jedrzejowicz:

Code:
<<  1000000  /  1.13  +  13  FOR  d  6.133  d  DDAYS  7  MOD  NOT  d  IFT  NEXT  >>

Since there are not many ways of doing it, the code looks very much like yours.

Same input as yours: Just the desired year. However, my version assumes MDY mode. Changing it to DMY is left as an exercise for the student.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
06-22-2014, 06:23 AM
Post: #3
RE: HP 49G Friday 13th calculation
Is this from Conway? Is there a pointer to a formula or discussion on this?

It ain't OVER 'till it's 2 PICK
Find all posts by this user
Quote this message in a reply
06-22-2014, 07:13 AM
Post: #4
RE: HP 49G Friday 13th calculation
(06-22-2014 06:16 AM)Joe Horn Wrote:  Here's my ancient User RPL version, which was included in "One-Minute Marvels" by Richard Nelson and Wlodek Mier-Jedrzejowicz:

Code:
<<  1000000  /  1.13  +  13  FOR  d  6.133  d  DDAYS  7  MOD  NOT  d  IFT  NEXT  >>

Since there are not many ways of doing it, the code looks very much like yours.

Same input as yours: Just the desired year. However, my version assumes MDY mode. Changing it to DMY is left as an exercise for the student.

I probably copied Joe Horn's prog some time ago. Credit to him.
Find all posts by this user
Quote this message in a reply
06-23-2014, 08:11 AM (This post was last modified: 06-24-2014 03:03 PM by Werner.)
Post: #5
RE: HP 49G Friday 13th calculation
Such a program should of course be independent of the date format setting.
Try this:
Code:
\<<
  6 ALOG / 12.12 + 
  1 12 START
    1 DATE+
    DUP 4.043 DDAYS 7 MOD NOT DUPN
    1.01 -
  NEXT
  DROP
\>>

Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
06-23-2014, 10:21 PM
Post: #6
RE: HP 49G Friday 13th calculation
(06-22-2014 06:16 AM)Joe Horn Wrote:  "One-Minute Marvels"
...Changing it to DMY is left as an exercise for the student.

"One-Minute Marvels" = pretty cool.
...I like PUSH POPs Smile

Thanks
~~~~8< Art >8~~~~

PS: Please post more 50G stuff :)
Find all posts by this user
Quote this message in a reply
06-24-2014, 12:32 AM
Post: #7
RE: HP 49G Friday 13th calculation
(06-23-2014 10:21 PM)CosmicTruth Wrote:  "One-Minute Marvels" = pretty cool.

Indeed! These are the very reason I, and a whole bunch of other folks, decided learning RPL was worth the time and effort. These and the EduCalc Technical Notes (also avail at hpcalc.org) are your best tools if trying to convince a friend (or yourself) to learn RPL. Real Good Stuff!!

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
06-24-2014, 05:03 AM
Post: #8
RE: HP 49G Friday 13th calculation
(06-23-2014 08:11 AM)Werner Wrote:  Such a program should of course be independent from the date format setting.
Try this:
Code:
\<<
  6 ALOG / 12.12 + 
  1 12 START
    1 DATE+
    DUP 4.043 DDAYS 7 MOD NOT DUPN
    1.01 -
  NEXT
  DROP
\>>

Cheers, Werner

Now THAT is a thing of beauty. Smile

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
06-24-2014, 07:30 AM
Post: #9
RE: HP 49G Friday 13th calculation
Thanks, Joe.
I missed the obvious shortcut: take -5. 6. START NEXT i.o. 1 12 START NEXT
Now it's 86.5 bytes - shorter than your original ;-)

Code:
\<<
  6. ALOG / 12.12 + 
  -5. 6. START
    1. DATE+
    DUP 4.043 DDAYS 7. MOD NOT DUPN
    1.01 -
  NEXT
  DROP
\>>

Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
06-24-2014, 02:05 PM (This post was last modified: 06-24-2014 10:17 PM by Alberto Candel.)
Post: #10
RE: HP 49G Friday 13th calculation
Those are pretty. Some time ago I read somewhere, I forget where, that over the years, the most frequent day for a 13th was a Friday, or the other way around. It should be easy to verify with these programs. Good for a coffee break.
Find all posts by this user
Quote this message in a reply
06-24-2014, 09:24 PM
Post: #11
RE: HP 49G Friday 13th calculation
(06-24-2014 07:30 AM)Werner Wrote:  Now it's 86.5 bytes - shorter than your original ;-)

[Image: notworthy.gif]

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
06-24-2014, 10:16 PM
Post: #12
RE: HP 49G Friday 13th calculation
(06-24-2014 02:05 PM)Alberto Candel Wrote:  Those are pretty. Some time ago I read somewhere, I forget where, that over the years, the most frequent day for a 13th was a Friday, or the other way around. It should be easy to verify with these programs. Good for a coffe break.

Unless my User RPL has bugs, you're right. The calendar repeats exactly every four centuries, so all we need to do is tally all 4800 13ths from 2000 through 2399. Here's what I got:

684 Thursdays & Saturdays
685 Mondays & Tuesdays
687 Sundays & Wednesdays
688 Fridays!

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)