Shabbat Chanukah

Eli Lansey

This code calculates which civil years never have a Shabbat Chanukah.  See blog post here: http://lanseybrothers.blogspot.com/2012/12/shabbat-on-chanuka.html
I can be reached by email: ELansey@gmail.com
My webpage: http://eli.lansey.net

Serial Evaluation: Years 3961-5773

Needs["Calendar`"]

dow[{year_,month_,day_,_:0,_:0,_:0}]:=Module[{Y=If[month==1||month==2,year-1,year],m=Mod[month+9,12]+1,y,c,s={Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday}},y=Mod[Y,100];
c=Quotient[Y,100];
s[[Mod[day+Floor[2.6 m-0.2]+y+Quotient[y,4]+Quotient[c,4]-2 c,7]+1]]];

chanukah[jewyear_]:=Table[DaysPlus[CalendarChange[{jewyear,9,25},Jewish,Gregorian],n],{n,0,7}]
chanukahJulian[jewyear_]:=Table[DaysPlus[CalendarChange[{jewyear,9,25},Jewish,Julian],n],{n,0,7}]

chanukahs = chanukah/@Range[3961,5773];

cdow={#,dow@#}&/@Flatten[chanukahs,1];

cdowy=GatherBy[cdow,#[[1,1]]&];

Select[GatherBy[cdow,#[[1,1]]&],Length@Select[#[[All,2]],#==Saturday&]==0&]

Parallel Long-Term Evaluations Years 3961-10000

LaunchKernels[]
ParallelNeeds["Calendar`"]

DistributeDefinitions[dow,chanukah,chanukahJulian];

chanukahs =ParallelMap[ chanukah,Range[3961,10000]];

cdow=ParallelMap[{#,dow@#}&,Flatten[chanukahs,1]];

cdowy=GatherBy[cdow,#[[1,1]]&];

res=Select[GatherBy[cdow,#[[1,1]]&],Length@Select[#[[All,2]],#==Saturday&]==0&];

years=res[[All,1,1,1]];

ListPlot[years,Frame->True,ImageSize->Large,FrameLabel->{"Occurence number","Gregorian calendar year"},LabelStyle->Directive[FontFamily->"Helvetica",Large],PlotRange->All,Epilog->{{Dashed,Line[{{0,2012},{Length@years,2012}}]},Text[Style["http://lanseybrothers.blogspot.com",16],Scaled[{.5,.925}]]},PlotLabel->Style["Gregorian Years without a Shabbat Chanukah",Large]]

yeardiff=Differences@res[[All,1,1,1]];

candle2=;

Histogram[yeardiff,"Log",PlotLabel->Style["Years between years without a Shabbat Chanukah",Large],ImageSize->Large,LabelStyle->Directive[FontFamily->"Helvetica",Large],ChartElements->{candle2,All}]