Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upEaster date gauss algorithm #2010
Merged
Conversation
other/gauss_easter.py
Outdated
| a = year % 19 | ||
| b = year % 4 | ||
| c = year % 7 | ||
| k = math.floor(year / 100) | ||
| p = math.floor((13 + 8 * k) / 25) | ||
| q = k / 4 | ||
| M = (15 - p + k - q) % 30 | ||
| N = (4 + k - q) % 7 | ||
| d = (19 * a + M) % 30 | ||
| e = (2 * b + 4 * c + 6 * d + N) % 7 |
Comment on lines
24
to
33
This comment has been minimized.
This comment has been minimized.
cclauss
May 19, 2020
Member
Single letter variable names are old school and they force the reader to guess a lot to make sense of this algorithm.
This comment has been minimized.
This comment has been minimized.
other/gauss_easter.py
Outdated
| print(f"Easter in 2023 will be {gauss_easter(2023)}") | ||
| print(f"Easter in 2021 will be {gauss_easter(2021)}") | ||
| print(f"Easter in 2010 was {gauss_easter(2010)}") | ||
| print(f"Easter in 1994 was {gauss_easter(1994)}") | ||
| print(f"Easter in 2000 was {gauss_easter(2000)}") |
Comment on lines
44
to
48
This comment has been minimized.
This comment has been minimized.
cclauss
May 19, 2020
Member
Suggested change
| print(f"Easter in 2023 will be {gauss_easter(2023)}") | |
| print(f"Easter in 2021 will be {gauss_easter(2021)}") | |
| print(f"Easter in 2010 was {gauss_easter(2010)}") | |
| print(f"Easter in 1994 was {gauss_easter(1994)}") | |
| print(f"Easter in 2000 was {gauss_easter(2000)}") | |
| for year in (1994, 2000, 2010, 2021, 2023): | |
| tense = "will be" if year > datetime.now().year else "was" | |
| print(f"Easter in {year} {tense} {gauss_easter(year)}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
mateuszz0000 commentedMay 19, 2020
Describe your change:
Added Gauss algorithm to calculate easter date for given year. Source: https://en.wikipedia.org/wiki/Computus#Gauss'_Easter_algorithm
Checklist:
Fixes: #{$ISSUE_NO}.