login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A157962 Table read by rows: Occurrences of Friday the 13th, T(n,1)=month (1 for January), T(n,2)=year-2000, starting year 2000. 3

%I #45 Sep 23 2019 13:33:42

%S 10,0,4,1,7,1,9,2,12,2,6,3,2,4,8,4,5,5,1,6,10,6,4,7,7,7,6,8,2,9,3,9,

%T 11,9,8,10,5,11,1,12,4,12,7,12,9,13,12,13,6,14,2,15,3,15,11,15,5,16,1,

%U 17,10,17,4,18,7,18,9,19,12,19,3,20,11,20,8,21,5,22,1,23,10,23,9,24,12,24

%N Table read by rows: Occurrences of Friday the 13th, T(n,1)=month (1 for January), T(n,2)=year-2000, starting year 2000.

%C Uses the Gregorian calendar.

%H Reinhard Zumkeller, <a href="/A157962/b157962.txt">Table of n, a(n) for n = 1..3442</a>

%H J. R. Stockton, <a href="https://web.archive.org/web/20140111181708/http://www.merlyn.demon.co.uk/zel-86px.htm">Rektor Chr. Zeller's 1886 Paper "Kalender-Formeln"</a> [Wayback Machine link from _Felix Fröhlich_, Sep 23 2019]

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Triskaidekaphobia.html">Triskaidekaphobia</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Triskaidekaphobia">Triskaidekaphobia</a>

%H Chr. Zeller, <a href="https://doi.org/10.1007/BF02406733">Kalender-Formeln</a>, Acta Mathematica, 9 (1886), 131-136.

%H <a href="/index/Rec#order_1376">Index entries for linear recurrences with constant coefficients</a>, order 1376.

%H <a href="/index/Ca#calendar">Index entries for sequences related to calendars</a>

%F a(2n+1) = a(2n + 1377), a(2n) = a(2n + 1376) + 400. - _Charles R Greathouse IV_, May 17 2011

%e a(39) = 1, a(40) = 12 -> Jan 2012,

%e a(41) = 4, a(42) = 12 -> Apr 2012,

%e a(43) = 7, a(44) = 12 -> Jul 2012,

%e a(45) = 9, a(46) = 13 -> Sep 2013.

%t << Calendar`; {y, m} = {2000, 1}; A157962 = {}; Do[ If[ m == 12, y = y + 1; m = 1, m = m + 1]; If[ DayOfWeek[ {y, m, 13}] == Friday, AppendTo[ A157962, {m , y - 2000}]] , {300}]; Flatten[A157962] (* _Jean-François Alcover_, Dec 16 2011 *)

%t Flatten[Table[If[DateValue[{2000+n,m,13},"DayName"]==Friday,{m,n},{}], {n,0,25},{m,12}]/.{}->Nothing] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, May 10 2017 *)

%o (VBA) jo = 6 For a = 2000 To 2399 For b = 1 To 31 jo = jo + 1: If jo = 7 Then jo = 0 If jo = 6 And b = 13 Then ll = ll + 1: Cells(ll, 1) = 1: Cells(ll, 2) = a - 2000 Next b If a - 4 * Int(a / 4) = 0 Then GoTo 10 For c = 1 To 28 jo = jo + 1: If jo = 7 Then jo = 0 If jo = 6 And c = 13 Then ll = ll + 1: Cells(ll, 1) = 2: Cells(ll, 2) = a - 2000 Next c GoTo 20 10 For c = 1 To 29 jo = jo + 1: If jo = 7

%o Then jo = 0 If jo = 6 And c = 13 Then ll = ll + 1: Cells(ll, 1) = 2: Cells(ll, 2) = a - 2000 Next c 20 For d = 1 To 31 jo = jo + 1: If jo = 7 Then jo = 0 If jo = 6 And d = 13 Then ll = ll + 1: Cells(ll, 1) = 3: Cells(ll, 2) = a - 2000 Next d For e = 1 To 30 jo = jo + 1: If jo = 7 Then jo = 0 If jo = 6 And e = 13 Then ll = ll + 1: Cells(ll, 1) = 4: Cells(ll, 2) = a - 2000 Next e For f = 1 To 31 jo = jo + 1: If jo = 7 Then jo = 0 If jo = 6 And f = 13 Then ll = ll + 1: Cells(ll, 1) = 5: Cells(ll, 2) = a - 2000 Next f For g = 1 To 30 jo = jo + 1: If jo = 7 Then jo = 0 If jo = 6 And g = 13 Then ll = ll + 1: Cells(ll, 1) = 6: Cells(ll, 2) = a - 2000 Next g For h = 1 To 31 jo = jo + 1: If jo = 7 Then jo = 0 If jo = 6 And h = 13 Then ll = ll + 1: Cells(ll, 1) = 7: Cells(ll, 2) = a - 2000 Next h For i = 1 To 31 jo = jo + 1: If jo = 7 Then jo = 0 If jo = 6 And i = 13

%o Then ll = ll + 1: Cells(ll, 1) = 8: Cells(ll, 2) = a - 2000 Next i For j = 1 To 30 jo = jo + 1: If jo = 7 Then jo = 0 If jo = 6 And j = 13 Then ll = ll + 1: Cells(ll, 1) = 9: Cells(ll, 2) = a - 2000 Next j For k = 1 To 31 jo = jo + 1: If jo = 7 Then jo = 0 If jo = 6 And k = 13 Then ll = ll + 1: Cells(ll, 1) = 10: Cells(ll, 2) = a - 2000 Next k For l = 1 To 30 jo = jo + 1: If jo = 7 Then jo = 0 If jo = 6 And l = 13 Then ll = ll + 1: Cells(ll, 1) = 11: Cells(ll, 2) = a - 2000 Next l For m = 1 To 31 jo = jo + 1: If jo = 7 Then jo = 0 If jo = 6 And m = 13 Then ll = ll + 1: Cells(ll, 1) = 12: Cells(ll, 2) = a - 2000 Next m Next a End Sub

%o (Haskell)

%o a157962 n = a157962_list !! (n-1)

%o a157962_list = concat $ map (t 1 {- January -}) [0..] where

%o t 13 _ = []

%o t m n | h (n+2000) m 13 == 6 = m : n : t (succ m) n

%o | otherwise = t (succ m) n

%o h year month day -- cf. Zeller reference.

%o | month <= 2 = h (year - 1) (month + 12) day

%o | otherwise = (day + 26 * (month + 1) `div` 10 + y + y `div` 4

%o + century `div` 4 - 2 * century) `mod` 7

%o where (century, y) = divMod year 100

%o -- _Reinhard Zumkeller_, May 17 2011

%Y Cf. A101312, A188528.

%K nonn,tabf,easy

%O 1,1

%A _Pierre CAMI_, Mar 10 2009

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 01:35 EDT 2024. Contains 371964 sequences. (Running on oeis4.)