Skip to content

feat(learn): teach the last-two-digits ÷4 leap shortcut (#7) - #27

Merged
tsenoner merged 2 commits into
mainfrom
fix/7-leap-shortcut
Jun 23, 2026
Merged

feat(learn): teach the last-two-digits ÷4 leap shortcut (#7)#27
tsenoner merged 2 commits into
mainfrom
fix/7-leap-shortcut

Conversation

@tsenoner

Copy link
Copy Markdown
Owner

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 00 and 100 = 4×25 is 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's isLeapYear.

Changes

  • curriculum.ts — replace the weak 2001–2099 line with a shortcut paragraph (two-digit examples 1968 → 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 and xx00 → ÷400 as the only carve-out (not the reverse). The full Gregorian rule, the ÷4/÷100/÷400 mnemonic, the 2024/1900/2000/2100 worked 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 + the 00 carve-out, guarding against regression.

Verification

typecheck ✓ · lint --max-warnings 0 ✓ · tests ✓ · build ✓. No engine change (doomsday.test.ts already covers isLeapYear ground truth).

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Jun 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
daycipher Ready Ready Preview, Comment Jun 23, 2026 11:58am

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>
@tsenoner
tsenoner merged commit 2f9fb4b into main Jun 23, 2026
3 checks passed
@tsenoner
tsenoner deleted the fix/7-leap-shortcut branch June 23, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Learn Stage 2 (Leap years): add the last-two-digits ÷4 shortcut

1 participant