Friday 13th program

+- HP Forums (http://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Friday 13th program (/thread-9310.html)



Friday 13th program - Joe Horn - 10-16-2017 09:02 AM

Perusing old postings I ran across several "Friday The 13th" programs, and whipped up this obvious-ware for the HP Prime.

Code:
EXPORT FRI13(Y)
BEGIN
LOCAL j;
L9:={};
FOR j FROM Y+.0113 TO Y+.1213 STEP .01 DO
IF DAYOFWEEK(j)==5 THEN L9:=CONCAT(L9,j) END;
END;
RETURN L9;
END;

An input of 2017 should return {2017.0113, 2017.1013}.

An input of 2026 should return a list containing 3 dates.



RE: Friday 13th program - Didier Lachieze - 10-17-2017 03:42 PM

In one line:
Code:
EXPORT FRI13(Y)
BEGIN
 DIFFERENCE(MAKELIST((DAYOFWEEK(J)==5)*J,J,Y+.0113,Y+.13,.01),0);
END;