feat(learn): teach the last-two-digits ÷4 leap shortcut (#7) - #27
Merged
Conversation
Stage 2 only gestured at the fast path ("for 2001–2099, just ask ÷4?"). State the
actual trick: for any non-century year only the last two digits matter for the ÷4
test — the hundreds always end in 00 and 100 is a multiple of 4, so they never
change the remainder. Verified exact for every non-century year across the full
proleptic range (9999 BC–9999 AD), 0 counterexamples vs isLeapYear.
- curriculum.ts: replace the weak "2001–2099: just ÷4" line with a shortcut
paragraph (two-digit examples 1968→68, 2008→08) + mnemonic; xx00 → ÷400 stays
the only carve-out. Full Gregorian rule, mnemonic, worked list, and the Jan/Feb
shift paragraph all kept.
- CheatSheet.tsx: generalize "(2001–2099: just ÷4.)" → "(Non-century year: last
two digits ÷4.)" so the cheat-sheet matches the lesson.
- curriculum.test.ts: lock the shortcut copy against regression.
Gates: typecheck, lint, tests, build — all green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The Stage-2 guard checked `toContain('00')`, which is satisfied by
incidental tokens (1900/2000/2100/2008) and passed against the old copy
too — so it guarded nothing about the new last-two-digits shortcut.
Assert the carve-out wording itself ('unless they are 00').
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7. Roadmap item 3/7.
Stage 2 "Leap years" only gestured at the fast path with one weak line ("For everyday dates in 2001–2099, just ask: divisible by 4?"). This states the actual mental trick.
The shortcut (research-verified)
For any year not ending in 00, only the last two digits matter for the ÷4 test — the hundreds always end in
00and100 = 4×25is a multiple of 4, so they never change the remainder (Y ≡ last-two-digits (mod 4)). An executable sweep in the research pass confirmed this is exact for every non-century year across the full proleptic range (9999 BC–9999 AD) — 0 counterexamples vs the engine'sisLeapYear.Changes
curriculum.ts— replace the weak2001–2099line with a shortcut paragraph (two-digit examples1968 → 68,2008 → 08) + mnemonic "Last two digits ÷4 — unless they are 00, then ÷400." The framing keeps last-two-digits-÷4 as the everyday rule andxx00 → ÷400as the only carve-out (not the reverse). The full Gregorian rule, the÷4/÷100/÷400mnemonic, the2024/1900/2000/2100worked list, and the Jan/Feb-shift paragraph are all kept.CheatSheet.tsx— generalize(2001–2099: just ÷4.)→(Non-century year: last two digits ÷4.)so the cheat-sheet agrees with the lesson. (This file was missing from the issue's affected-files list — flagged by the research.)curriculum.test.ts— assert Stage 2's copy contains the shortcut + the00carve-out, guarding against regression.Verification
typecheck ✓ · lint
--max-warnings 0✓ · tests ✓ · build ✓. No engine change (doomsday.test.tsalready coversisLeapYearground truth).🤖 Generated with Claude Code