All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Fridays (Posted on 2014-11-03) Difficulty: 2 of 5
What is the maximal number of ”Friday the 13th “
in a calendar year?

Would your answer be the same for ”Friday the 29th “?

See The Solution Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution Comment 1 of 1
leap first                                                                Fridays
      day                   relevant dates                                13  29
     d o w                                                                counts
 0    1          1  13         9  29         10  13        12  29          2  2 
 0    2          4  13         6  29         7  13                         2  1 
 0    3          3  29         9  13         11  29        12  13          2  2 
 0    4          6  13         8  29                                       1  1 
 0    5          2  13         3  13         5  29         11  13          3  1 
 0    6          1  29         8  13         10  29                        1  2 
 0    7          4  29         5  13         7  29                         1  2 
 1    1          1  13         4  13         6  29         7  13           3  1 
 1    2          3  29         9  13         11  29        12  13          2  2 
 1    3          2  29         6  13         8  29                         1  2 
 1    4          3  13         5  29         11  13                        2  1 
 1    5          2  13         8  13         10  29                        2  1 
 1    6          1  29         4  29         5  13         7  29           1  3 
 1    7          9  29         10  13        12  29                        1  2
 

There are at most 3 Friday the 13ths in a year: in ordinary years beginning on a Thursday and in leap years starting on a Sunday.

There are also at most 3 Friday the 29ths in a year: in leap years beginning on a Friday.

DATA 31,28,31,30,31,30,31,31,30,31,30,31
DIM lngth(12)
OPEN "fridays.txt" FOR OUTPUT AS #2


FOR leap = 0 TO 1
    RESTORE
    FOR i = 1 TO 12: READ lngth(i): NEXT
    lngth(2) = lngth(2) + leap
    FOR strt = 1 TO 7
        PRINT #2, leap; strt,
        ct13 = 0: ct29 = 0
        stMo = strt: mo = 1
        DO
            da13 = (stMo + 12) MOD 7
            da29 = (stMo + 28) MOD 7
            IF da13 = 6 THEN ct13 = ct13 + 1: PRINT #2, mo; 13,
            IF da29 = 6 AND 29 <= lngth(mo) THEN ct29 = ct29 + 1: PRINT #2, mo; 29,
            stMo = (stMo + lngth(mo)) MOD 7
            mo = mo + 1
        LOOP UNTIL mo > 12
        PRINT #2, TAB(73); ct13; ct29
    NEXT strt
NEXT leap


  Posted by Charlie on 2014-11-03 10:54:22
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (8)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information