how many Friday 13th?
[This article was first published on R – Xi'an's Og, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
A short Riddler’s riddle on the maximum number of Fridays 13th over a calendar year, of which I found 9 by a dumb exploration :
bi=c(1:31,1:29,1:31,1:30,1:31,1:30,1:31,1:31,1:30,1:31,1:30,1:31)
oy=bi[-60]
for(j in 0:(length(cy<-c(bi,oy,oy,oy))-1)){#any day in quartade
dy=c(cy[(j+1):length(cy)],cy[1:j])
for(i in 0:6){
dz=(i+(1:length(cy)))%%7
if((k<-sum((dz==5)*(cy==13)))>9)print(c(i,j,k))}}
with no change whatsoever when starting another day of the year, including a Friday 13.(since this only gains 13 days!). An example of a quartade (!) with nine such days is the sequence 2012-2015 with 3+2+1+3 occurences….
To leave a comment for the author, please follow the link and comment on their blog: R – Xi'an's Og.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.