How to count occurrences of Friday 13thDetermining the week of a year from a given dateJewishNewYear date...
When was drinking water recognized as crucial in marathon running?
Sometimes a banana is just a banana
How can I handle a player who pre-plans arguments about my rulings on RAW?
Is it 40% or 0.4%?
Exponential growth/decay formula: what happened to the other constant of integration?
Can you 'upgrade' leather armor to studded leather armor without purchasing the new armor directly?
I encountered my boss during an on-site interview at another company. Should I bring it up when seeing him next time?
How to count occurrences of Friday 13th
What is a term for a function that when called repeatedly, has the same effect as calling once?
Significance and timing of "mux scans"
What are these green text/line displays shown during the livestream of Crew Dragon's approach to dock with the ISS?
Hacker Rank: Array left rotation
Compare four integers, return word based on maximum
Whom do I have to contact for a ticket refund in case of denied boarding (in the EU)?
How to deny access to SQL Server to certain login over SSMS, but allow over .Net SqlClient Data Provider
How do I construct an nxn matrix?
As a new poet, where can I find help from a professional to judge my work?
How to avoid being sexist when trying to employ someone to function in a very sexist environment?
Is divide-by-zero a security vulnerability?
How do ISS astronauts "get their stripes"?
Why does the author believe that the central mass that gas cloud HCN-0.009-0.044 orbits is smaller than our solar system?
chrony vs. systemd-timesyncd – What are the differences and use cases as NTP clients?
What am I? I am in theaters and computer programs
What's the purpose of these copper coils with resistors inside them in A Yamaha RX-V396RDS amplifier?
How to count occurrences of Friday 13th
Determining the week of a year from a given dateJewishNewYear date limitationHow to sum values in the list that belongs to same weekEasterSunday replacement in Mathematica 10Iterate over days of year to make a list/graphHow to LinearModelFit data like {{year,month,day,hour,minute,second,variable}}?Timing evaluation times dynamicallyAdd another holiday to the built-in holiday calendarHow to programmatically determine information about a DateObjectcompute a length excluding periodic segments
$begingroup$
I would like to find a function that will count the number of times Friday 13th happens in a particular calendar year.
Does anybody have any hints ?
Thank you
date-and-time
New contributor
$endgroup$
add a comment |
$begingroup$
I would like to find a function that will count the number of times Friday 13th happens in a particular calendar year.
Does anybody have any hints ?
Thank you
date-and-time
New contributor
$endgroup$
1
$begingroup$
I fell into a delightful rabbit hole of day-counting algorithms on Wikipedia. I wanted to leave a link to the Doomsday algorithm for mental calculation of the day of the week, for fun: Doomsday rule on Wiki.
$endgroup$
– MarcoB
6 hours ago
$begingroup$
Wolfram Challenges.
$endgroup$
– J. M. is computer-less♦
33 mins ago
add a comment |
$begingroup$
I would like to find a function that will count the number of times Friday 13th happens in a particular calendar year.
Does anybody have any hints ?
Thank you
date-and-time
New contributor
$endgroup$
I would like to find a function that will count the number of times Friday 13th happens in a particular calendar year.
Does anybody have any hints ?
Thank you
date-and-time
date-and-time
New contributor
New contributor
edited 33 mins ago
J. M. is computer-less♦
97.1k10303463
97.1k10303463
New contributor
asked 7 hours ago
BradPeterson87BradPeterson87
333
333
New contributor
New contributor
1
$begingroup$
I fell into a delightful rabbit hole of day-counting algorithms on Wikipedia. I wanted to leave a link to the Doomsday algorithm for mental calculation of the day of the week, for fun: Doomsday rule on Wiki.
$endgroup$
– MarcoB
6 hours ago
$begingroup$
Wolfram Challenges.
$endgroup$
– J. M. is computer-less♦
33 mins ago
add a comment |
1
$begingroup$
I fell into a delightful rabbit hole of day-counting algorithms on Wikipedia. I wanted to leave a link to the Doomsday algorithm for mental calculation of the day of the week, for fun: Doomsday rule on Wiki.
$endgroup$
– MarcoB
6 hours ago
$begingroup$
Wolfram Challenges.
$endgroup$
– J. M. is computer-less♦
33 mins ago
1
1
$begingroup$
I fell into a delightful rabbit hole of day-counting algorithms on Wikipedia. I wanted to leave a link to the Doomsday algorithm for mental calculation of the day of the week, for fun: Doomsday rule on Wiki.
$endgroup$
– MarcoB
6 hours ago
$begingroup$
I fell into a delightful rabbit hole of day-counting algorithms on Wikipedia. I wanted to leave a link to the Doomsday algorithm for mental calculation of the day of the week, for fun: Doomsday rule on Wiki.
$endgroup$
– MarcoB
6 hours ago
$begingroup$
Wolfram Challenges.
$endgroup$
– J. M. is computer-less♦
33 mins ago
$begingroup$
Wolfram Challenges.
$endgroup$
– J. M. is computer-less♦
33 mins ago
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
Select[
Table[DateObject@{2019, m, 13}, {m, 12}],
DateString[#, "DayName"] === "Friday" &
]
{Day: Fri 13 Sep 2019,Day: Fri 13 Dec 2019}
countFri13[year_Integer]:=Length @ Select[
Table[DateObject@{year, m, 13}, {m, 12}],
DateString[#, "DayName"] === "Friday" &
]
$endgroup$
add a comment |
$begingroup$
I worked on this problem in 2015. Here is part on my notebook from that time.
A not so good algorithm.
friday13th[year_Integer] :=
Select[DayName[#] === Friday &] @
DateRange[DateObject[{year, 1, 13}], DateObject[{year, 12, 13}], {1, "Month"}]
A good algorithm.
friday13th[year_Integer] :=
Select[DayName[#] === Friday &] @ Table[DateObject[{year, i, 13}], {i, 12}]
A better algorithm.
friday13th[year_Integer] :=
Select[DayName[#] === Friday &] @ Array[DateObject[{year, #, 13}] &, 12]
Using the better algorithm, I got (at the time I created the notebook)
friday13th @ 2014
friday13th @ 2015
And for this year, I get
friday13th @ 2019
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "387"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
BradPeterson87 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f192605%2fhow-to-count-occurrences-of-friday-13th%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Select[
Table[DateObject@{2019, m, 13}, {m, 12}],
DateString[#, "DayName"] === "Friday" &
]
{Day: Fri 13 Sep 2019,Day: Fri 13 Dec 2019}
countFri13[year_Integer]:=Length @ Select[
Table[DateObject@{year, m, 13}, {m, 12}],
DateString[#, "DayName"] === "Friday" &
]
$endgroup$
add a comment |
$begingroup$
Select[
Table[DateObject@{2019, m, 13}, {m, 12}],
DateString[#, "DayName"] === "Friday" &
]
{Day: Fri 13 Sep 2019,Day: Fri 13 Dec 2019}
countFri13[year_Integer]:=Length @ Select[
Table[DateObject@{year, m, 13}, {m, 12}],
DateString[#, "DayName"] === "Friday" &
]
$endgroup$
add a comment |
$begingroup$
Select[
Table[DateObject@{2019, m, 13}, {m, 12}],
DateString[#, "DayName"] === "Friday" &
]
{Day: Fri 13 Sep 2019,Day: Fri 13 Dec 2019}
countFri13[year_Integer]:=Length @ Select[
Table[DateObject@{year, m, 13}, {m, 12}],
DateString[#, "DayName"] === "Friday" &
]
$endgroup$
Select[
Table[DateObject@{2019, m, 13}, {m, 12}],
DateString[#, "DayName"] === "Friday" &
]
{Day: Fri 13 Sep 2019,Day: Fri 13 Dec 2019}
countFri13[year_Integer]:=Length @ Select[
Table[DateObject@{year, m, 13}, {m, 12}],
DateString[#, "DayName"] === "Friday" &
]
answered 7 hours ago
Kuba♦Kuba
106k12205527
106k12205527
add a comment |
add a comment |
$begingroup$
I worked on this problem in 2015. Here is part on my notebook from that time.
A not so good algorithm.
friday13th[year_Integer] :=
Select[DayName[#] === Friday &] @
DateRange[DateObject[{year, 1, 13}], DateObject[{year, 12, 13}], {1, "Month"}]
A good algorithm.
friday13th[year_Integer] :=
Select[DayName[#] === Friday &] @ Table[DateObject[{year, i, 13}], {i, 12}]
A better algorithm.
friday13th[year_Integer] :=
Select[DayName[#] === Friday &] @ Array[DateObject[{year, #, 13}] &, 12]
Using the better algorithm, I got (at the time I created the notebook)
friday13th @ 2014
friday13th @ 2015
And for this year, I get
friday13th @ 2019
$endgroup$
add a comment |
$begingroup$
I worked on this problem in 2015. Here is part on my notebook from that time.
A not so good algorithm.
friday13th[year_Integer] :=
Select[DayName[#] === Friday &] @
DateRange[DateObject[{year, 1, 13}], DateObject[{year, 12, 13}], {1, "Month"}]
A good algorithm.
friday13th[year_Integer] :=
Select[DayName[#] === Friday &] @ Table[DateObject[{year, i, 13}], {i, 12}]
A better algorithm.
friday13th[year_Integer] :=
Select[DayName[#] === Friday &] @ Array[DateObject[{year, #, 13}] &, 12]
Using the better algorithm, I got (at the time I created the notebook)
friday13th @ 2014
friday13th @ 2015
And for this year, I get
friday13th @ 2019
$endgroup$
add a comment |
$begingroup$
I worked on this problem in 2015. Here is part on my notebook from that time.
A not so good algorithm.
friday13th[year_Integer] :=
Select[DayName[#] === Friday &] @
DateRange[DateObject[{year, 1, 13}], DateObject[{year, 12, 13}], {1, "Month"}]
A good algorithm.
friday13th[year_Integer] :=
Select[DayName[#] === Friday &] @ Table[DateObject[{year, i, 13}], {i, 12}]
A better algorithm.
friday13th[year_Integer] :=
Select[DayName[#] === Friday &] @ Array[DateObject[{year, #, 13}] &, 12]
Using the better algorithm, I got (at the time I created the notebook)
friday13th @ 2014
friday13th @ 2015
And for this year, I get
friday13th @ 2019
$endgroup$
I worked on this problem in 2015. Here is part on my notebook from that time.
A not so good algorithm.
friday13th[year_Integer] :=
Select[DayName[#] === Friday &] @
DateRange[DateObject[{year, 1, 13}], DateObject[{year, 12, 13}], {1, "Month"}]
A good algorithm.
friday13th[year_Integer] :=
Select[DayName[#] === Friday &] @ Table[DateObject[{year, i, 13}], {i, 12}]
A better algorithm.
friday13th[year_Integer] :=
Select[DayName[#] === Friday &] @ Array[DateObject[{year, #, 13}] &, 12]
Using the better algorithm, I got (at the time I created the notebook)
friday13th @ 2014
friday13th @ 2015
And for this year, I get
friday13th @ 2019
answered 7 hours ago
m_goldbergm_goldberg
87.2k872197
87.2k872197
add a comment |
add a comment |
BradPeterson87 is a new contributor. Be nice, and check out our Code of Conduct.
BradPeterson87 is a new contributor. Be nice, and check out our Code of Conduct.
BradPeterson87 is a new contributor. Be nice, and check out our Code of Conduct.
BradPeterson87 is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f192605%2fhow-to-count-occurrences-of-friday-13th%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
$begingroup$
I fell into a delightful rabbit hole of day-counting algorithms on Wikipedia. I wanted to leave a link to the Doomsday algorithm for mental calculation of the day of the week, for fun: Doomsday rule on Wiki.
$endgroup$
– MarcoB
6 hours ago
$begingroup$
Wolfram Challenges.
$endgroup$
– J. M. is computer-less♦
33 mins ago