Tomohiko Sakamoto’s algorithm
E638639
Tomohiko Sakamoto’s algorithm is a compact, table-based method for calculating the day of the week for any given date in the Gregorian calendar.
All labels observed (1)
| Label | Occurrences |
|---|---|
| Tomohiko Sakamoto’s algorithm canonical | 1 |
Statements (42)
| Predicate | Object |
|---|---|
| instanceOf |
algorithm
ⓘ
date calculation algorithm ⓘ day-of-week algorithm ⓘ |
| advantage |
requires only a small lookup table
ⓘ
simple integer arithmetic only ⓘ |
| appliesTo | Gregorian calendar NERFINISHED ⓘ |
| assumes | proleptic Gregorian calendar for all years in implementation ⓘ |
| basedOn | modular arithmetic ⓘ |
| category | calendar algorithm ⓘ |
| characteristic |
compact implementation
ⓘ
constant time complexity ⓘ table-based method ⓘ uses month offset table ⓘ |
| commonUse |
calendar utilities
ⓘ
date libraries ⓘ embedded systems date calculations ⓘ |
| comparedTo |
Doomsday rule
NERFINISHED
ⓘ
Zeller’s congruence NERFINISHED ⓘ |
| creator | Tomohiko Sakamoto NERFINISHED ⓘ |
| handles | leap years in the Gregorian calendar ⓘ |
| implementationLanguage | C NERFINISHED ⓘ |
| input |
day
ⓘ
month ⓘ year ⓘ |
| mapsTo | weekday index 0–6 ⓘ |
| output | day of the week ⓘ |
| property |
deterministic
ⓘ
does not require floating-point arithmetic ⓘ non-iterative ⓘ |
| requires | integer division and modulo operations ⓘ |
| suitableFor |
programming contest solutions
ⓘ
resource-constrained environments ⓘ |
| timeComplexity | O(1) ⓘ |
| typicalConvention |
0 = Sunday
ⓘ
1 = Monday ⓘ 2 = Tuesday ⓘ 3 = Wednesday ⓘ 4 = Thursday ⓘ 5 = Friday ⓘ 6 = Saturday ⓘ |
| usedFor |
calculating the day of the week
ⓘ
computing weekday from a Gregorian calendar date ⓘ |
Referenced by (1)
Full triples — surface form annotated when it differs from this entity's canonical label.